loleaflet/src/geometry/Bounds.js | 10 ++++++++++ loleaflet/src/layer/SplitPanesContext.js | 11 +++++++++++ loleaflet/src/layer/tile/CalcTileLayer.js | 16 ++++++++++++---- 3 files changed, 33 insertions(+), 4 deletions(-)
New commits: commit 6cba945dc16b634b1db95491b7d1cab3f120e6e1 Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Wed Jul 8 07:02:26 2020 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Wed Jul 8 17:12:48 2020 +0200 handle tile-invalidation messages for split-panes Change-Id: Ib349987dee456198d611eabbc9171a14f0670f24 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98361 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/loleaflet/src/geometry/Bounds.js b/loleaflet/src/geometry/Bounds.js index 957e03fe1..cadc8e225 100644 --- a/loleaflet/src/geometry/Bounds.js +++ b/loleaflet/src/geometry/Bounds.js @@ -165,6 +165,16 @@ L.Bounds.prototype = { isValid: function () { return !!(this.min && this.max); + }, + + intersectsAny: function (boundsArray) { + for (var i = 0; i < boundsArray.length; ++i) { + if (boundsArray[i].intersects(this)) { + return true; + } + } + + return false; } }; diff --git a/loleaflet/src/layer/SplitPanesContext.js b/loleaflet/src/layer/SplitPanesContext.js index 5d4909298..45dd502e0 100644 --- a/loleaflet/src/layer/SplitPanesContext.js +++ b/loleaflet/src/layer/SplitPanesContext.js @@ -174,6 +174,17 @@ L.SplitPanesContext = L.Class.extend({ return boundList; }, + getTwipsBoundList: function (pxBounds) { + var bounds = this.getPxBoundList(pxBounds); + var docLayer = this._docLayer; + return bounds.map(function (bound) { + return new L.Bounds( + docLayer._pixelsToTwips(bound.min), + docLayer._pixelsToTwips(bound.max) + ); + }); + }, + getClientVisibleArea: function () { var pixelBounds = this._map.getPixelBounds(); var fullSize = pixelBounds.getSize(); diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js index 1dfd7811c..116a4231d 100644 --- a/loleaflet/src/layer/tile/CalcTileLayer.js +++ b/loleaflet/src/layer/tile/CalcTileLayer.js @@ -373,10 +373,17 @@ L.CalcTileLayer = L.TileLayer.extend({ if (this._debug) { this._debugAddInvalidationRectangle(topLeftTwips, bottomRightTwips, textMsg); } + var invalidBounds = new L.Bounds(topLeftTwips, bottomRightTwips); - var visibleTopLeft = this._latLngToTwips(this._map.getBounds().getNorthWest()); - var visibleBottomRight = this._latLngToTwips(this._map.getBounds().getSouthEast()); - var visibleArea = new L.Bounds(visibleTopLeft, visibleBottomRight); + var visibleArea, visiblePaneAreas; + if (this._splitPanesContext) { + visiblePaneAreas = this._splitPanesContext.getTwipsBoundList(); + } + else { + var visibleTopLeft = this._latLngToTwips(this._map.getBounds().getNorthWest()); + var visibleBottomRight = this._latLngToTwips(this._map.getBounds().getSouthEast()); + visibleArea = new L.Bounds(visibleTopLeft, visibleBottomRight); + } var needsNewTiles = false; for (var key in this._tiles) { @@ -391,7 +398,8 @@ L.CalcTileLayer = L.TileLayer.extend({ else { this._tiles[key]._invalidCount = 1; } - if (visibleArea.intersects(bounds)) { + var intersectsVisible = visibleArea ? visibleArea.intersects(bounds) : bounds.intersectsAny(visiblePaneAreas); + if (intersectsVisible) { needsNewTiles = true; if (this._debug) { this._debugAddInvalidationData(this._tiles[key]); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits