[Libreoffice-commits] online.git: Branch 'feature/calc-canvas' - loleaflet/src

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 10 14:36:09 UTC 2020


 loleaflet/src/layer/tile/CanvasTileLayer.js |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

New commits:
commit 693c60eebf1cc285e5b9ff8941207efedd898c3c
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Sep 10 15:35:27 2020 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Sep 10 15:35:27 2020 +0100

    calc canvas: get the right core px size of the canvas across.
    
    Change-Id: Ib079097b9d5caf707bd95b286d675791b5df9255

diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index d035f6ee9..5ab4b7ff2 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -97,16 +97,16 @@ L.CanvasTilePainter = L.Class.extend({
 	},
 
 	_setCanvasSize: function (widthCSSPx, heightCSSPx) {
-		var pixWidth = Math.floor(widthCSSPx * this._dpiScale);
-		var pixHeight = Math.floor(heightCSSPx * this._dpiScale);
+		this._pixWidth = Math.floor(widthCSSPx * this._dpiScale);
+		this._pixHeight = Math.floor(heightCSSPx * this._dpiScale);
 
 		// real pixels have to be integral
-		this._canvas.width = pixWidth;
-		this._canvas.height = pixHeight;
+		this._canvas.width = this._pixWidth;
+		this._canvas.height = this._pixHeight;
 
 		// CSS pixels can be fractional, but need to round to the same real pixels
-		var cssWidth = pixWidth / this._dpiScale; // NB. beware
-		var cssHeight = pixHeight / this._dpiScale;
+		var cssWidth = this._pixWidth / this._dpiScale; // NB. beware
+		var cssHeight = this._pixHeight / this._dpiScale;
 		this._canvas.style.width = cssWidth.toFixed(4) + 'px';
 		this._canvas.style.height = cssHeight.toFixed(4) + 'px';
 
@@ -148,8 +148,9 @@ L.CanvasTilePainter = L.Class.extend({
 		var paneBoundsList = splitPanesContext ?
 		    splitPanesContext.getPxBoundList(viewBounds) :
 		    [viewBounds];
+		var canvasCorePx = new L.Point(this._pixWidth, this._pixHeight);
 
-		return { canvasSize: this._lastSize,
+		return { canvasSize: canvasCorePx,
 			 tileSize: tileSize,
 			 viewBounds: viewBounds,
 			 paneBoundsList: paneBoundsList };


More information about the Libreoffice-commits mailing list