[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Nov 7 14:16:27 UTC 2018


 loleaflet/src/layer/AnnotationManager.js |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit c48054f18a1c34d5460a2b9ec74fe57c122ef0a6
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Nov 7 14:14:46 2018 +0000
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Nov 7 14:16:07 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 5636456ba..d5007b14a 100644
--- a/loleaflet/src/layer/AnnotationManager.js
+++ b/loleaflet/src/layer/AnnotationManager.js
@@ -330,7 +330,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;
@@ -416,6 +416,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);


More information about the Libreoffice-commits mailing list