[Libreoffice-commits] online.git: Branch 'feature/calc-canvas' - loleaflet/src
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 3 21:21:04 UTC 2020
loleaflet/src/map/Map.js | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 80ed51d01f9e58e830acd17d7223384dcf376bdd
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Thu Sep 3 23:19:13 2020 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Sep 3 23:19:13 2020 +0200
calc canvas: Preserving of the top left cell should be desktop-only.
On mobile, the center of the zooming has to be according to the center
of the pinch-to-zoom, ie. the center has to be taken into account.
Change-Id: I3ba2ea90b7bac9bc1ba27f8068ea7ed6bbb4910d
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 4221d8a4d..e7c3b281d 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -480,20 +480,22 @@ L.Map = L.Evented.extend({
// for spreadsheets, when the document is smaller than the viewing area
// we want it to be glued to the row/column headers instead of being centered
this._docLayer._checkSpreadSheetBounds(zoom);
- var calcLayer = this._docLayer;
- if (calcLayer.options.sheetGeometryDataEnabled && calcLayer.sheetGeometry) {
- var sheetGeom = calcLayer.sheetGeometry;
- var cellRange = sheetGeom.getViewCellRange();
- var col = cellRange.columnrange.start, row = cellRange.rowrange.start;
- var zoomScaleAbs = this.zoomToFactor(zoom);
+ if (window.mode.isDesktop()) {
+ var calcLayer = this._docLayer;
+ if (calcLayer.options.sheetGeometryDataEnabled && calcLayer.sheetGeometry) {
+ var sheetGeom = calcLayer.sheetGeometry;
+ var cellRange = sheetGeom.getViewCellRange();
+ var col = cellRange.columnrange.start, row = cellRange.rowrange.start;
+ var zoomScaleAbs = this.zoomToFactor(zoom);
- var newTopLeftPx = sheetGeom.getCellRect(col, row, zoomScaleAbs).getTopLeft();
- var moveByPoint = this._getTopLeftPoint(curCenter, zoom).subtract(newTopLeftPx);
+ var newTopLeftPx = sheetGeom.getCellRect(col, row, zoomScaleAbs).getTopLeft();
+ var moveByPoint = this._getTopLeftPoint(curCenter, zoom).subtract(newTopLeftPx);
- // move the center (which is in LatLng) by the computed amount of pixels
- var newCenterLatLng = this.unproject(this.project(curCenter, zoom).subtract(moveByPoint), zoom);
+ // move the center (which is in LatLng) by the computed amount of pixels
+ var newCenterLatLng = this.unproject(this.project(curCenter, zoom).subtract(moveByPoint), zoom);
- return this.setView(newCenterLatLng, zoom, {zoom: options});
+ return this.setView(newCenterLatLng, zoom, {zoom: options});
+ }
}
}
More information about the Libreoffice-commits
mailing list