loleaflet/src/layer/tile/GridLayer.js | 4 +++- loleaflet/src/layer/tile/TileLayer.js | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-)
New commits: commit d0586f9267ed074b93acef720bcc1e37cb09cba4 Author: Mihai Varga <mihai.va...@collabora.com> Date: Wed Jul 1 10:47:05 2015 +0300 Maintain an invalidation count for each tile Count how many times a tile has been invalidated. For each inalidation increase the counter and for each arrival of the new tile decrease it. Only cache tiles with the invalidation count equal to 0 because when zooming, we might cancel previous requests and the tiles in the old zoom layer are no longer valid diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js index b095a2c..3137e6c 100644 --- a/loleaflet/src/layer/tile/GridLayer.js +++ b/loleaflet/src/layer/tile/GridLayer.js @@ -591,7 +591,9 @@ L.GridLayer = L.Layer.extend({ // FIXME: this _tileCache is used for prev/next slide; but it is // dangerous in connection with typing / invalidation, so let's // comment it out for now - this._tileCache[key] = tile.el.src; + if (!(this._tiles[key]._invalidCount > 0)) { + this._tileCache[key] = tile.el.src; + } L.DomUtil.remove(tile.el); delete this._tiles[key]; diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index bb245ed..276d763 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -341,6 +341,12 @@ L.TileLayer = L.GridLayer.extend({ var point2 = new L.Point(point1.x + this._tileWidthTwips, point1.y + this._tileHeightTwips); var bounds = new L.Bounds(point1, point2); if (invalidBounds.intersects(bounds)) { + if (this._tiles[key]._invalidCount) { + this._tiles[key]._invalidCount += 1; + } + else { + this._tiles[key]._invalidCount = 1; + } this._map.socket.send('tile ' + 'part=' + coords.part + ' ' + 'width=' + this._tileSize + ' ' + @@ -357,11 +363,11 @@ L.TileLayer = L.GridLayer.extend({ coords = this._keyToTileCoords(key); var scale = this._map.getZoomScale(coords.z); topLeftTwips = new L.Point( - this.options.tileWidthTwips * scale * coords.x, - this.options.tileHeightTwips * scale * coords.y); + this.options.tileWidthTwips / scale * coords.x, + this.options.tileHeightTwips / scale * coords.y); bottomRightTwips = topLeftTwips.add(new L.Point( - this.options.tileWidthTwips * scale, - this.options.tileHeightTwips * scale)); + this.options.tileWidthTwips / scale, + this.options.tileHeightTwips / scale)); bounds = new L.Bounds(topLeftTwips, bottomRightTwips); if (invalidBounds.intersects(bounds)) { delete this._tileCache[key]; @@ -414,6 +420,9 @@ L.TileLayer = L.GridLayer.extend({ if (tile.el.src) { this._map._fadeAnimated = false; } + if (this._tiles[key]._invalidCount && this._tiles[key]._invalidCount > 0) { + this._tiles[key]._invalidCount -= 1; + } tile.el.src = 'data:image/png;base64,' + window.btoa(strBytes); } else { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits