loleaflet/src/layer/AnnotationManager.js | 11 +++++++---- loleaflet/src/layer/tile/WriterTileLayer.js | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-)
New commits: commit 75e06f76877290504445039442ed068b513235bc Author: Henry Castro <hcas...@collabora.com> Date: Tue Apr 11 20:37:53 2017 -0400 loleaflet: fix position when adding new annotation Change-Id: I267df778715cb9f60c1b62c52ed405fd78ade8f9 diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 8f178357..5178c921 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -233,6 +233,7 @@ L.AnnotationManager = L.Class.extend({ return Math.abs(a._data.anchorPos.min.y) - Math.abs(b._data.anchorPos.min.y) || Math.abs(a._data.anchorPos.min.x) - Math.abs(b._data.anchorPos.min.x); }); + return annotation; }, edit: function (comment) { @@ -337,7 +338,10 @@ L.AnnotationManager = L.Class.extend({ _onAnnotationCancel: function (e) { if (e.annotation._data.id === 'new') { - this._map.removeLayer(e.annotation); + this._map.removeLayer(this.removeItem(e.annotation._data.id)); + } + if (this._selected === e.annotation) { + this.unselect(); } else { this.layout(); } @@ -378,9 +382,8 @@ L.AnnotationManager = L.Class.extend({ } }; this._map.sendUnoCommand('.uno:InsertAnnotation', comment); - this._map.removeLayer(e.annotation); - } - else if (e.annotation._data.trackchange) { + this._map.removeLayer(this.removeItem(e.annotation._data.id)); + } else if (e.annotation._data.trackchange) { comment = { ChangeTrackingId: { type: 'long', diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js index b13c6df1..8e5edcb3 100644 --- a/loleaflet/src/layer/tile/WriterTileLayer.js +++ b/loleaflet/src/layer/tile/WriterTileLayer.js @@ -9,9 +9,10 @@ L.WriterTileLayer = L.TileLayer.extend({ if (!comment.anchorPos && this._isCursorVisible) { comment.anchorPos = L.bounds(this._latLngToTwips(this._visibleCursor.getSouthWest()), this._latLngToTwips(this._visibleCursor.getNorthEast())); + comment.anchorPix = this._twipsToPixels(comment.anchorPos.min); } if (comment.anchorPos) { - this._annotations.edit(comment); + this._annotations.modify(this._annotations.add(comment)); } }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits