loleaflet/src/layer/AnnotationManager.js | 19 ++++--------------- loleaflet/src/layer/marker/Annotation.js | 4 +++- 2 files changed, 7 insertions(+), 16 deletions(-)
New commits: commit 43cf95adffec6f4bb6172c5577331c0e60c80cac Author: Henry Castro <hcas...@collabora.com> Date: Thu Feb 1 21:43:15 2018 -0400 loleaflet: propagate text selected events to parent element Change-Id: I9b88c42b6bf40dfe856e92f345633855234c7a5d diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index c9a6a09b..6219c68c 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -70,15 +70,9 @@ L.AnnotationManager = L.Class.extend({ weight: 2, opacity: 0.25 }); + comment.textSelected.addEventParent(this._map); L.DomEvent.on(comment.textSelected, 'contextmenu', L.DomEvent.preventDefault); - comment.textSelected.on('click', function(e) { - // Simulate a click at this position in the document - var latlng = this._map.mouseEventToLatLng(e.originalEvent); - var pos = this._map._docLayer._latLngToTwips(latlng); - this._map._docLayer._postMouseEvent('buttondown', pos.x, pos.y, 1, 1, 0); - this._map._docLayer._postMouseEvent('buttonup', pos.x, pos.y, 1, 1, 0); - - // Also select this comment + comment.textSelected.on('click', function() { this.selectById(comment.id); }, this); } @@ -105,14 +99,9 @@ L.AnnotationManager = L.Class.extend({ fillOpacity: 0, opacity: 0 }); + redline.textSelected.addEventParent(this._map); L.DomEvent.on(redline.textSelected, 'contextmenu', L.DomEvent.preventDefault); - redline.textSelected.on('click', function(e) { - // Simulate a click at this position in the document - var latlng = this._map.mouseEventToLatLng(e.originalEvent); - var pos = this._map._docLayer._latLngToTwips(latlng); - this._map._docLayer._postMouseEvent('buttondown', pos.x, pos.y, 1, 1, 0); - this._map._docLayer._postMouseEvent('buttonup', pos.x, pos.y, 1, 1, 0); - + redline.textSelected.on('click', function() { this.selectById(redline.id); }, this); } diff --git a/loleaflet/src/layer/marker/Annotation.js b/loleaflet/src/layer/marker/Annotation.js index e357811c..810208c1 100644 --- a/loleaflet/src/layer/marker/Annotation.js +++ b/loleaflet/src/layer/marker/Annotation.js @@ -37,7 +37,8 @@ L.Annotation = L.Layer.extend({ onRemove: function (map) { map._panes.popupPane.removeChild(this._container); if (this._data.textSelected) { - this._map.removeLayer(this._data.textSelected); + this._data.textSelected.removeEventParent(map); + map.removeLayer(this._data.textSelected); } this._map = null; }, @@ -52,6 +53,7 @@ L.Annotation = L.Layer.extend({ setData: function (data) { if (this._data.textSelected) { + this._data.textSelected.removeEventParent(this._map); this._map.removeLayer(this._data.textSelected); } this._data = data; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits