[Libreoffice-commits] online.git: loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 13 12:13:33 UTC 2020


 loleaflet/src/control/Control.PartsPreview.js |   17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

New commits:
commit f192a5e7ba50f79328f478db8d70698de8984fe0
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Jan 10 11:47:29 2020 -0400
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Mon Jan 13 13:13:15 2020 +0100

    loleaflet: simplifiy click listener on thumbnail previews
    
    It is complicated to debug 5 event listener attached to an element,
    let's use one event listener.
    
    Change-Id: I9de1f1707f95f07a49358c8e7580ad232edd4389
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/86567
    Reviewed-by: Henry Castro <hcastro at collabora.com>
    Tested-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 12c5bab19..212eb25b5 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -163,15 +163,14 @@ L.Control.PartsPreview = L.Control.extend({
 		img.hash = hashCode;
 		img.src = L.Icon.Default.imagePath + '/preview_placeholder.png';
 		img.fetched = false;
-		L.DomEvent
-			.on(img, 'click', L.DomEvent.stopPropagation)
-			.on(img, 'click', L.DomEvent.stop)
-			.on(img, 'click', this._setPart, this)
-			.on(img, 'click', this._map.focus, this._map)
-			.on(img, 'click', function() {
-				this.partsFocused = true;
-				document.activeElement.blur();
-			}, this);
+		L.DomEvent.on(img, 'click', function (e) {
+			L.DomEvent.stopPropagation(e);
+			L.DomEvent.stop(e);
+			this._setPart(e);
+			this._map.focus();
+			this.partsFocused = true;
+			document.activeElement.blur();
+		}, this);
 
 		var topBound = this._previewContTop;
 		var previewFrameTop = 0;


More information about the Libreoffice-commits mailing list