[Libreoffice-commits] online.git: loleaflet/src
mert (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 21 17:07:21 UTC 2020
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.tumer at collabora.com>
AuthorDate: Thu Feb 20 18:36:09 2020 +0300
Commit: Michael Meeks <michael.meeks at 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 <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at 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) {
More information about the Libreoffice-commits
mailing list