diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2020-08-24 15:50:44 +0530 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2020-09-17 15:03:01 +0200 |
commit | 1c2c4f1ed6440e7683043ab192e65daf6397f97c (patch) | |
tree | 76843398940edcbeb0f85c4d51e403fdaf15cd99 | |
parent | 2635aed4320af2d4672a7073adcb490cb5ecc248 (diff) |
calc-canvas: make tile size fixed (256) for every device
Change-Id: I4e00b8b43f73f001a8bcfc77931f5fa22982642e
-rw-r--r-- | loleaflet/src/layer/tile/CalcTileLayer.js | 5 | ||||
-rw-r--r-- | loleaflet/src/layer/tile/CanvasTileLayer.js | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index a178a59da..417cf0e16 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -4,7 +4,8 @@ */ /* global */ -L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({ +var BaseTileLayer = L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer; +L.CalcTileLayer = BaseTileLayer.extend({ options: { // TODO: sync these automatically from SAL_LOK_OPTIONS sheetGeometryDataEnabled: true, @@ -81,7 +82,7 @@ L.CalcTileLayer = (L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer).extend({ map.addControl(L.control.tabs()); map.addControl(L.control.columnHeader()); map.addControl(L.control.rowHeader()); - L.TileLayer.prototype.onAdd.call(this, map); + BaseTileLayer.prototype.onAdd.call(this, map); map.on('resize', function () { if (this.isCursorVisible()) { diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js index 70f6c8a36..ba74b2c4c 100644 --- a/loleaflet/src/layer/tile/CanvasTileLayer.js +++ b/loleaflet/src/layer/tile/CanvasTileLayer.js @@ -373,6 +373,16 @@ L.CanvasTileLayer = L.TileLayer.extend({ return false; }, + onAdd: function (map) { + + // Override L.TileLayer._tilePixelScale to 1 (independent of the device). + this._tileWidthPx = this.options.tileSize; + this._tileHeightPx = this.options.tileSize; + this._tilePixelScale = 1; + + L.TileLayer.prototype.onAdd.call(this, map); + }, + onRemove: function (map) { this._painter.dispose(); L.TileLayer.prototype.onRemove.call(this, map); |