From b51cc9ce62ee7f7148330a514bc26922e0c7ad37 Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Thu, 11 Mar 2021 16:59:08 +0530 Subject: [PATCH] fixes: ghost pages/tiles in writer The issue is: On creating a page break on a empty writer file and hitting backspace, the deleted page or parts of it is still rendered. We get a 'status' message containing the document size every time it changes. So avoid the issue do not draw tiles that are not within the document area. Signed-off-by: Dennis Francis Change-Id: I88d1715e861f068326d28d2930d01e3b5355be02 --- loleaflet/src/layer/tile/TilesSection.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/loleaflet/src/layer/tile/TilesSection.ts b/loleaflet/src/layer/tile/TilesSection.ts index ba81ac5a0..0369580ca 100644 --- a/loleaflet/src/layer/tile/TilesSection.ts +++ b/loleaflet/src/layer/tile/TilesSection.ts @@ -196,8 +196,8 @@ class TilesSection { this.oscCtxs[i].fillRect(0, 0, this.offscreenCanvases[i].width, this.offscreenCanvases[i].height); } - var tileRanges = ctx.paneBoundsList.map(this.sectionProperties.docLayer._pxBoundsToTileRange, this.sectionProperties.docLayer); - + var docLayer = this.sectionProperties.docLayer; + var tileRanges = ctx.paneBoundsList.map(docLayer._pxBoundsToTileRange, docLayer); for (var rangeIdx = 0; rangeIdx < tileRanges.length; ++rangeIdx) { var tileRange = tileRanges[rangeIdx]; for (var j = tileRange.min.y; j <= tileRange.max.y; ++j) { @@ -210,7 +210,8 @@ class TilesSection { var key = coords.key(); var tile = this.sectionProperties.docLayer._tiles[key]; - if (tile && tile.loaded) { + // Ensure tile is loaded and is within document bounds. + if (tile && tile.loaded && docLayer._isValidTile(coords)) { this.paint(tile, ctx, false /* async? */); } }