summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2020-08-24 22:12:18 +0530
committerJan Holesovsky <kendy@collabora.com>2020-09-02 14:57:34 +0200
commit95544951ca46563e01bbf6eea056cfa6104569e0 (patch)
tree79956e9ebc054e267b3a137fd83a2932f4116f05
parentcompute nearest zoomlevel with devpixelratio included (diff)
downloadonline-95544951ca46563e01bbf6eea056cfa6104569e0.tar.gz
online-95544951ca46563e01bbf6eea056cfa6104569e0.zip
setup the header canvases in the same way as the tile-canvas
All drawings to it needs to in css pixels for now, because the mouse/touch handlers need positions in css pixels and the HeaderInfo datastructure has everything in css pixels. Moving the headers to the main-canvas needs more work but this change will help in doing that. Change-Id: I6a19e62a67b2b42975a51bb695db300ce493ba01
-rw-r--r--loleaflet/src/control/Control.ColumnHeader.js3
-rw-r--r--loleaflet/src/control/Control.Header.js3
-rw-r--r--loleaflet/src/control/Control.RowHeader.js3
3 files changed, 6 insertions, 3 deletions
diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index d6eccf5b12..4639acd960 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -224,7 +224,8 @@ L.Control.ColumnHeader = L.Control.Header.extend({
return;
ctx.save();
- var scale = L.getDpiScaleFactor();
+ var useExactDPR = this._map && (this._map._docLayer instanceof L.CanvasTileLayer);
+ var scale = L.getDpiScaleFactor(useExactDPR);
ctx.scale(scale, scale);
// background gradient
var selectionBackgroundGradient = null;
diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index bb0d4433f5..757cfd5c84 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -579,6 +579,7 @@ L.Control.Header = L.Control.extend({
},
_setCanvasSizeImpl: function (container, canvas, property, value, isCorner) {
+ var useExactDPR = this._map && (this._map._docLayer instanceof L.CanvasTileLayer);
if (!value) {
value = parseInt(L.DomUtil.getStyle(container, property));
}
@@ -586,7 +587,7 @@ L.Control.Header = L.Control.extend({
L.DomUtil.setStyle(container, property, value + 'px');
}
- var scale = L.getDpiScaleFactor();
+ var scale = L.getDpiScaleFactor(useExactDPR);
if (property === 'width') {
canvas.width = value * scale;
if (!isCorner)
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 8e80aec73b..80ccbbe1b9 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -217,7 +217,8 @@ L.Control.RowHeader = L.Control.Header.extend({
return;
ctx.save();
- var scale = L.getDpiScaleFactor();
+ var useExactDPR = this._map && (this._map._docLayer instanceof L.CanvasTileLayer);
+ var scale = L.getDpiScaleFactor(useExactDPR);
ctx.scale(scale, scale);
// background gradient
var selectionBackgroundGradient = null;