loleaflet/src/control/Control.Toolbar.js | 20 +++++++++++++++++++- loleaflet/src/layer/tile/TileLayer.js | 13 +++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-)
New commits: commit 864749bb1681e352f3c6e63548f31d3ede63422a Author: mert <mert.tu...@collabora.com> AuthorDate: Thu Feb 20 18:36:09 2020 +0300 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Feb 21 18:07:02 2020 +0100 mobile: implemented popup for hyperlinks on calc Change-Id: I6d22cc1d6b7da8afbb9cce70c3445634455b34d8 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89122 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js index c627e49cd..6c47153f2 100644 --- a/loleaflet/src/control/Control.Toolbar.js +++ b/loleaflet/src/control/Control.Toolbar.js @@ -2609,7 +2609,25 @@ function setupToolbar(e) { }); map.on('hyperlinkclicked', function (e) { - map.fire('warn', {url: e.url, map: map, cmd: 'openlink'}); + if (e.url) { + if (e.coordinates) { + var strTwips = e.coordinates.match(/\d+/g); + var topLeftTwips = new L.Point(parseInt(strTwips[6]), parseInt(strTwips[1])); + var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3])); + var bottomRightTwips = topLeftTwips.add(offset); + var cellCursor = new L.LatLngBounds( + map._docLayer._twipsToLatLng(topLeftTwips, map.getZoom()), + map._docLayer._twipsToLatLng(bottomRightTwips, map.getZoom())); + //click pos tweak + cellCursor._northEast.lng = cellCursor._southWest.lng; + map.hyperlinkPopup = new L.Popup({className: 'hyperlink-popup', closeButton: false, closeOnClick: false}) + .setContent('<a href="' + e.url + '" target="_blank">' + e.url + '</a>') + .setLatLng(cellCursor._northEast) + .openOn(map); + } else { + map.fire('warn', {url: e.url, map: map, cmd: 'openlink'}); + } + } }); map.on('zoomend', function () { diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 0939570e3..a0fff8280 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -1093,8 +1093,17 @@ L.TileLayer = L.GridLayer.extend({ }, _onHyperlinkClickedMsg: function (textMsg) { - var link = textMsg.substring(18); - this._map.fire('hyperlinkclicked', {url: link}); + var link = null; + var coords = null; + + if (textMsg.includes('coordinates')) { + var coordpos = textMsg.indexOf(' coordinates'); + link = textMsg.substring(18, coordpos); + coords = textMsg.substring(coordpos+12); + } else + link = textMsg.substring(18); + + this._map.fire('hyperlinkclicked', {url: link, coordinates: coords}); }, _onInvalidateCursorMsg: function (textMsg) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits