loleaflet/src/layer/tile/GridLayer.js |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 449c0a387f59ad075cb880d1cb688ec9586120a9
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Mon Jul 13 20:06:30 2015 +0300

    loleaflet: check already visited tiles when prefetching
    
    In order to avoid duplicate tiles

diff --git a/loleaflet/src/layer/tile/GridLayer.js 
b/loleaflet/src/layer/tile/GridLayer.js
index fc67031..7a59ae4 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -546,8 +546,8 @@ L.GridLayer = L.Layer.extend({
                if (coords.x < 0 || coords.y < 0) {
                        return false;
                }
-               if (coords.x * this._tileWidthTwips > this._docWidthTwips ||
-                               coords.y * this._tileHeightTwips > 
this._docHeightTwips) {
+               if (coords.x * this._tileWidthTwips >= this._docWidthTwips ||
+                               coords.y * this._tileHeightTwips >= 
this._docHeightTwips) {
                        return false;
                }
                return true;
@@ -806,6 +806,7 @@ L.GridLayer = L.Layer.extend({
                }
                var queue = [],
                        finalQueue = [],
+                       visitedTiles = {},
                        tilesToFetch = 10,
                        borderWidth = 0;
                        // don't search on a border wider than 5 tiles because 
it will freeze the UI
@@ -845,10 +846,12 @@ L.GridLayer = L.Layer.extend({
 
                                if (!this._isValidTile(coords) ||
                                                this._tiles[key] ||
-                                               this._tileCache[key]) {
+                                               this._tileCache[key] ||
+                                               visitedTiles[key]) {
                                        continue;
                                }
 
+                               visitedTiles[key] = true;
                                finalQueue.push(coords);
                                tilesToFetch -= 1;
                        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to