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.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;