loleaflet/src/layer/tile/CanvasTileLayer.js | 37 ++++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-)
New commits: commit 224526c9678be37b4ac4258b1f01c7df473c50bc Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Sat Sep 19 21:47:34 2020 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Sep 21 09:57:16 2020 +0200 calc grid: render during canvas 'clear' if we can. Also re-render as soon as we have grid positions. Change-Id: I57095683e662991badcb3a58832c81ebb3bc460d Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103043 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js index 15d813939..285fa11c3 100644 --- a/loleaflet/src/layer/tile/CanvasTileLayer.js +++ b/loleaflet/src/layer/tile/CanvasTileLayer.js @@ -130,12 +130,22 @@ L.CanvasTilePainter = L.Class.extend({ } }, - clear: function () { - if (this._layer._debug) - this._canvasCtx.fillStyle = 'rgba(255, 0, 0, 0.5)'; + clear: function (ctx) { + // First render the background / sheet grid if we can + if (this.renderBackground) + { + if (!ctx) + ctx = this._paintContext(); + this.renderBackground(this._canvasCtx, ctx); + } else - this._canvasCtx.fillStyle = 'white'; - this._canvasCtx.fillRect(0, 0, this._pixWidth, this._pixHeight); + { + if (this._layer._debug) + this._canvasCtx.fillStyle = 'rgba(255, 0, 0, 0.5)'; + else + this._canvasCtx.fillStyle = 'white'; + this._canvasCtx.fillRect(0, 0, this._pixWidth, this._pixHeight); + } }, // Details of tile areas to render @@ -265,11 +275,13 @@ L.CanvasTilePainter = L.Class.extend({ if (skipUpdate) return; + var ctx; if (resizeCanvas || scaleChanged) { this._setCanvasSize(newSize.x, newSize.y); } else if (mapSizeChanged && topLeftChanged) { - this.clear(); + ctx = this._paintContext(); + this.clear(ctx); } if (mapSizeChanged) @@ -282,24 +294,22 @@ L.CanvasTilePainter = L.Class.extend({ this._lastPart = part; this._topLeft = newTopLeft; - this._paintWholeCanvas(); + this._paintWholeCanvas(ctx); if (this._layer._debug) this._drawSplits(); }, - _paintWholeCanvas: function () { + _paintWholeCanvas: function(ctx) { var zoom = this._lastZoom || Math.round(this._map.getZoom()); var part = this._lastPart || this._layer._selectedPart; // Calculate all this here intead of doing it per tile. - var ctx = this._paintContext(); - - // First render the background / sheet grid if we can - if (this.renderBackground) - this.renderBackground(this._canvasCtx, ctx); + if (!ctx) + ctx = this._paintContext(); + this.clear(ctx); var tileRanges = ctx.paneBoundsList.map(this._layer._pxBoundsToTileRange, this._layer); for (var rangeIdx = 0; rangeIdx < tileRanges.length; ++rangeIdx) { @@ -451,6 +461,7 @@ L.CanvasTileLayer = L.TileLayer.extend({ } canvas.closePath(); }; + this._painter.clear(); }, hasSplitPanesSupport: function () { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits