summaryrefslogtreecommitdiff
path: root/loleaflet
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2020-09-15 09:15:44 +0200
committerJan Holesovsky <kendy@collabora.com>2020-09-17 15:03:01 +0200
commitf668b590010f4487a1dd1f7171131334fb98d908 (patch)
tree8f814aa3bc10a769f23847a0505a4f37907ea369 /loleaflet
parent0176bbeb6a2dab57b04eeaac2b0e65448a2845cc (diff)
calc canvas: More reliable check for the desktop / mobile / tablet.
Change-Id: I7b1ea581051608e020fd6e4615be9bc9b919c01f
Diffstat (limited to 'loleaflet')
-rw-r--r--loleaflet/js/global.js4
-rw-r--r--loleaflet/src/layer/tile/CalcTileLayer.js4
-rw-r--r--loleaflet/src/layer/tile/CanvasTileLayer.js2
-rw-r--r--loleaflet/src/map/anim/Map.ZoomAnimation.js3
4 files changed, 11 insertions, 2 deletions
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 0b39b8d21..aeb62042b 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -189,6 +189,10 @@
return !L.Browser.mobile;
},
+ useCanvasLayer: function() {
+ // FIXME the CanvasTileLayer is so far desktop-only
+ return global.mode.isDesktop();
+ },
getDeviceFormFactor: function() {
if (window.mode.isMobile())
return 'mobile';
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index eedf8966a..e6813ad65 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -4,7 +4,9 @@
*/
/* global */
-var BaseTileLayer = L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer;
+
+var BaseTileLayer = window.mode.useCanvasLayer() ? L.CanvasTileLayer : L.TileLayer;
+
L.CalcTileLayer = BaseTileLayer.extend({
options: {
// TODO: sync these automatically from SAL_LOK_OPTIONS
diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index 0790a24c7..5c93af7de 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -396,6 +396,8 @@ L.CanvasTileLayer = L.TileLayer.extend({
},
onAdd: function (map) {
+ if (!window.mode.useCanvasLayer())
+ return;
// Override L.TileLayer._tilePixelScale to 1 (independent of the device).
this._tileWidthPx = this.options.tileSize;
diff --git a/loleaflet/src/map/anim/Map.ZoomAnimation.js b/loleaflet/src/map/anim/Map.ZoomAnimation.js
index ddd38486f..25738c638 100644
--- a/loleaflet/src/map/anim/Map.ZoomAnimation.js
+++ b/loleaflet/src/map/anim/Map.ZoomAnimation.js
@@ -8,7 +8,8 @@ L.Map.mergeOptions({
zoomAnimationThreshold: 4
});
-var zoomAnimated = L.DomUtil.TRANSITION && L.Browser.any3d && !L.Browser.mobileOpera;
+// Conditions for the animated zoom
+var zoomAnimated = L.DomUtil.TRANSITION && L.Browser.any3d && !L.Browser.mobileOpera && !window.mode.useCanvasLayer();
if (zoomAnimated) {