summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-05-24 18:26:05 +0530
committerDennis Francis <dennis.francis@collabora.com>2020-05-25 00:52:45 +0530
commit5f735f3085f53f2306edeb1d85ae9e26df9a9a55 (patch)
tree107986503f4f24f6e3037c380e7ff7c7d91b5004
parentAllow conversion of print-twips coordinates to tile-twips... (diff)
downloadonline-5f735f3085f53f2306edeb1d85ae9e26df9a9a55.tar.gz
online-5f735f3085f53f2306edeb1d85ae9e26df9a9a55.zip
Handle print-twips 'cellcursor' msg from correctly
This is conditioned on the flag printTwipsMsgsEnabled. Change-Id: I61a9165a9f81ce7473c3fa6579947f34552dbdaf
-rw-r--r--loleaflet/src/layer/tile/CalcTileLayer.js4
-rw-r--r--loleaflet/src/layer/tile/TileLayer.js16
2 files changed, 16 insertions, 4 deletions
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 852df733b6..e5ef90114c 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: true
+ // TODO: sync these automatically from SAL_LOK_OPTIONS
+ sheetGeometryDataEnabled: true,
+ printTwipsMsgsEnabled: true
},
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 ded1b572c4..f74adf613e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1132,10 +1132,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]));
}
@@ -3367,6 +3368,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};
},