diff options
-rw-r--r-- | loleaflet/src/layer/tile/CalcTileLayer.js | 4 | ||||
-rw-r--r-- | loleaflet/src/layer/tile/TileLayer.js | 16 |
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}; }, |