[Libreoffice-commits] online.git: loleaflet/src

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Sun Jul 5 14:31:15 UTC 2020


 loleaflet/src/layer/tile/CalcTileLayer.js |    4 +++-
 loleaflet/src/layer/tile/TileLayer.js     |   16 +++++++++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit e2c8e486fe208af1f84c9f8f75f7b111c81c8a5d
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Sun May 24 18:26:05 2020 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Sun Jul 5 16:30:54 2020 +0200

    Handle print-twips 'cellcursor' msg from correctly
    
    This is conditioned on the flag printTwipsMsgsEnabled.
    
    Change-Id: I61a9165a9f81ce7473c3fa6579947f34552dbdaf
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98106
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 478ea87e8..b067c9dcc 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -6,7 +6,9 @@
 /* global */
 L.CalcTileLayer = L.TileLayer.extend({
 	options: {
-		sheetGeometryDataEnabled: false
+		// TODO: sync these automatically from SAL_LOK_OPTIONS
+		sheetGeometryDataEnabled: false,
+		printTwipsMsgsEnabled: false
 	},
 
 	STD_EXTRA_WIDTH: 113, /* 2mm extra for optimal width,
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 0fe28e7ea..e0ac093c6 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1145,10 +1145,11 @@ L.TileLayer = L.GridLayer.extend({
 			var topLeftTwips = new L.Point(parseInt(strTwips[0]), parseInt(strTwips[1]));
 			var offset = new L.Point(parseInt(strTwips[2]), parseInt(strTwips[3]));
 			var bottomRightTwips = topLeftTwips.add(offset);
-			this._cellCursorTwips = new L.Bounds(topLeftTwips, bottomRightTwips);
+			this._cellCursorTwips = this._convertToTileTwipsSheetArea(
+							new L.Bounds(topLeftTwips, bottomRightTwips));
 			this._cellCursor = new L.LatLngBounds(
-							this._twipsToLatLng(topLeftTwips, this._map.getZoom()),
-							this._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
+					this._twipsToLatLng(this._cellCursorTwips.getTopLeft(), this._map.getZoom()),
+					this._twipsToLatLng(this._cellCursorTwips.getBottomRight(), this._map.getZoom()));
 			this._cellCursorXY = new L.Point(parseInt(strTwips[4]), parseInt(strTwips[5]));
 		}
 
@@ -3380,6 +3381,15 @@ L.TileLayer = L.GridLayer.extend({
 		}
 	},
 
+	// convert the area in print-twips to tile-twips by computing the involved cell-range.
+	_convertToTileTwipsSheetArea: function (rectangle) {
+		if (!(rectangle instanceof L.Bounds) || !this.options.printTwipsMsgsEnabled) {
+			return rectangle;
+		}
+
+		return this.sheetGeometry.getTileTwipsSheetAreaFromPrint(rectangle);
+	},
+
 	_debugGetTimeArray: function() {
 		return {count: 0, ms: 0, best: Number.MAX_SAFE_INTEGER, worst: 0, date: 0};
 	},


More information about the Libreoffice-commits mailing list