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@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2020-01-10 11:47:29 -04:00
parent 77e0f99c07
commit f192a5e7ba

View file

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