loleaflet/src/layer/AnnotationManager.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
New commits: commit ef8fd317a2d019783c86e25e9c71add744f012da Author: Pranav Kant <pran...@collabora.co.uk> Date: Wed Apr 26 13:15:10 2017 +0530 loleaflet: Allow mouse clicks to pass through comment/redline selection Otherwise, it was not possible to use the mouse to click on the text beneath the text selection svg layer. This simulates a mouse click on the document after selecting the comment. Change-Id: Ia2717a0a4356f40e31db94b68563abffc87cac37 (cherry picked from commit e3ef5d01afa5773e5562a5e5a30274c0d4ee1761) Reviewed-on: https://gerrit.libreoffice.org/36977 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> diff --git a/loleaflet/src/layer/AnnotationManager.js b/loleaflet/src/layer/AnnotationManager.js index 19dbb5bb..167960d3 100644 --- a/loleaflet/src/layer/AnnotationManager.js +++ b/loleaflet/src/layer/AnnotationManager.js @@ -57,13 +57,21 @@ L.AnnotationManager = L.Class.extend({ color = viewId >= 0 ? L.LOUtil.rgbToHex(this._map.getViewColor(viewId)) : '#43ACE8'; if (rectangles.length > 0) { comment.textSelected = L.polygon(rectangles, { - interactive: true, + pointerEvents: 'all', + interactive: false, fillColor: color, fillOpacity: 0.25, weight: 2, opacity: 0.25 }); - comment.textSelected.on('click', function() { + 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 this.selectById(comment.id); }, this); } @@ -88,11 +96,18 @@ L.AnnotationManager = L.Class.extend({ color = viewId >= 0 ? L.LOUtil.rgbToHex(this._map.getViewColor(viewId)) : '#43ACE8'; if (rectangles.length > 0) { redline.textSelected = L.polygon(rectangles, { - interactive: true, + pointerEvents: 'all', + interactive: false, fillOpacity: 0, opacity: 0 }); - redline.textSelected.on('click', function() { + 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); + this.selectById(redline.id); }, this); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits