loleaflet/src/layer/tile/GridLayer.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
New commits: commit b5cbd467d92bed75d340ffaf1b847229b32b0b1e Author: Mihai Varga <mihai.m...@gmail.com> Date: Tue Jun 23 13:44:35 2015 +0300 Cancel tile request for tiles out of the visible area This provides a better scrolling experience When a large enough number of tiles have been requested we know that they will cover the whole viewing area so we're able to cancel the previous (not yet fulfilled) requests diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js index 48f11e1..bab0c23 100644 --- a/loleaflet/src/layer/tile/GridLayer.js +++ b/loleaflet/src/layer/tile/GridLayer.js @@ -39,6 +39,10 @@ L.GridLayer = L.Layer.extend({ this._viewReset(); this._update(); this._map._docLayer = this; + var mapDim = this._map.getSize(); + this._maxVisibleTiles = + (Math.floor(mapDim.x / this._tileSize) + 2) * + (Math.floor(mapDim.y / this._tileSize) + 2); }, beforeAdd: function (map) { @@ -483,6 +487,18 @@ L.GridLayer = L.Layer.extend({ } if (queue.length !== 0) { + if (queue.length > this._maxVisibleTiles) { + // we know that a new set of tiles that cover the whole view has been requested + // so we're able to cancel the previous requests that are being processed + this._map.socket.send('canceltiles'); + for (var key in this._tiles) { + if (!this._tiles[key].loaded) { + L.DomUtil.remove(this._tiles[key].el); + delete this._tiles[key]; + } + } + } + // if its the first batch of tiles to load if (this._noTilesToLoad()) { this.fire('loading'); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits