loleaflet/src/layer/tile/CalcTileLayer.js   |    5 ++---
 loleaflet/src/layer/tile/CanvasTileLayer.js |   22 +++++++++++++++-------
 2 files changed, 17 insertions(+), 10 deletions(-)

New commits:
commit cd1f1293d9a33f77e37397ac7d69a9cb0b765fea
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Sep 1 16:53:02 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Tue Sep 1 16:53:02 2020 +0100

    calc tiles: don't send un-necessary zoom / visible area changes.
    
    Lots of redundant zoom messages seem unhelpful.
    
    Change-Id: I944a3202739adfc89aab81902b467a4e34977202

diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js 
b/loleaflet/src/layer/tile/CanvasTileLayer.js
index 8ef3cb886..8643f8bf7 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -697,9 +697,8 @@ L.CanvasTileLayer = L.TileLayer.extend({
                        }
                }
 
-               this._sendClientVisibleArea(true);
-
-               this._sendClientZoom(true);
+               this._sendClientVisibleArea();
+               this._sendClientZoom();
 
                if (queue.length !== 0) {
                        if (cancelTiles) {
commit ebacd1a031e41dfe873128a35f1ab6cb1c51b101
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Sep 1 16:52:35 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Tue Sep 1 16:52:35 2020 +0100

    calc tiles: use canvas rendering for mobile too.
    
    This way the row/column headers line up - and it's the future.
    
    Change-Id: I56b2c2527dcc751ed06fc3b30aff22544ec4c269

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js 
b/loleaflet/src/layer/tile/CalcTileLayer.js
index 403f2e27e..7bc11901e 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -4,8 +4,7 @@
  */
 
 /* global */
-var BaseTileLayer = L.Browser.mobile ? L.TileLayer : L.CanvasTileLayer;
-L.CalcTileLayer = BaseTileLayer.extend({
+L.CalcTileLayer = L.CanvasTileLayer.extend({
        options: {
                // TODO: sync these automatically from SAL_LOK_OPTIONS
                sheetGeometryDataEnabled: true,
@@ -82,7 +81,7 @@ L.CalcTileLayer = BaseTileLayer.extend({
                map.addControl(L.control.tabs());
                map.addControl(L.control.columnHeader());
                map.addControl(L.control.rowHeader());
-               BaseTileLayer.prototype.onAdd.call(this, map);
+               L.CanvasTileLayer.prototype.onAdd.call(this, map);
 
                map.on('resize', function () {
                        if (this.isCursorVisible()) {
commit ee15411f94a9bd90c84facd4cb9b09057fa6a768
Author:     Michael Meeks <michael.me...@collabora.com>
AuthorDate: Tue Sep 1 16:24:18 2020 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Tue Sep 1 16:24:18 2020 +0100

    calc canvas: ensure that the fraction width rounds to the pixel width.
    
    Slave CSS geometry from integral canvas pixels, don't attempt the
    reverse.
    
    Change-Id: I369ed1bea3c4a5a199192aa1e84bb4e03dcb2e94

diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js 
b/loleaflet/src/layer/tile/CanvasTileLayer.js
index 4983fef2a..8ef3cb886 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -96,11 +96,20 @@ L.CanvasTilePainter = L.Class.extend({
        },
 
        _setCanvasSize: function (widthCSSPx, heightCSSPx) {
-               this._canvas.style.width = widthCSSPx + 'px';
-               this._canvas.style.height = heightCSSPx + 'px';
-               this._canvas.width = Math.floor(widthCSSPx * this._dpiScale);
-               this._canvas.height = Math.floor(heightCSSPx * this._dpiScale);
+               var pixWidth = Math.floor(widthCSSPx * this._dpiScale);
+               var pixHeight = Math.floor(heightCSSPx * this._dpiScale);
 
+               // real pixels have to be integral
+               this._canvas.width = pixWidth;
+               this._canvas.height = 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;
+               this._canvas.style.width = cssWidth.toFixed(4) + 'px';
+               this._canvas.style.height = cssHeight.toFixed(4) + 'px';
+
+               // FIXME: is this a good idea ? :
                this._width = parseInt(this._canvas.style.width);
                this._height = parseInt(this._canvas.style.height);
                this.clear();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to