loleaflet/src/layer/AnnotationManager.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 5ba1dec1f82fcb66e3b154fa0a507497a52a6714 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Wed Nov 7 14:14:46 2018 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Wed Nov 7 14:17:35 2018 +0000 Avoid synchronous re-layout of comments / red-lines on each modification. Change-Id: I698c6d47a58cfab2096900e01d19c8f4d4693fc4 diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 56579ccd2..6927eb32e 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -328,7 +328,7 @@ L.AnnotationManager = L.Class.extend({ } }, - layout: function (zoom) { + doLayout: function (zoom) { var docRight = this._map.project(this._map.options.docBounds.getNorthEast()); var topRight = docRight.add(L.point(this.options.marginX, this.options.marginY)); var latlng, layoutBounds, point, idx; @@ -414,6 +414,19 @@ L.AnnotationManager = L.Class.extend({ } }, + layout: function (zoom) { + if (zoom) + this.doLayout(zoom); + else if (!this._layoutTimer) { + var me = this; + me._layoutTimer = setTimeout(function() { + delete me._layoutTimer; + me.doLayout(zoom); + }, 250 /* ms */); + } // else - avoid excessive re-layout + + }, + add: function (comment) { var annotation = L.annotation(this._map._docLayer._twipsToLatLng(comment.anchorPos.getTopRight()), comment, comment.id === 'new' ? {noMenu: true} : {}).addTo(this._map); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits