[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - loleaflet/src

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 6 15:22:20 UTC 2020


 loleaflet/src/layer/tile/GridLayer.js |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 49e45c45dd69ee6057410c074c6c262c1a0eda72
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 9 16:37:23 2019 +0000
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jan 6 16:22:02 2020 +0100

    prefetch: disable interval timer when we've pre-fetched everything.
    
    Change-Id: I9d3b3819b3d9a960aa31f729686315e9e5d6d8e1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/84776
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 55cb0263e..9999bbb48 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -1262,6 +1262,9 @@ L.GridLayer = L.Layer.extend({
 			var fragment = document.createDocumentFragment();
 			this._addTiles(finalQueue, fragment);
 			this._level.el.appendChild(fragment);
+		} else {
+			clearInterval(this._tilesPreFetcher);
+			this._tilesPreFetcher = undefined;
 		}
 	},
 
@@ -1269,8 +1272,10 @@ L.GridLayer = L.Layer.extend({
 		if (!this._map) {
 			return;
 		}
-		clearInterval(this._tilesPreFetcher);
-		clearTimeout(this._preFetchIdle);
+		if (this._tilesPreFetcher)
+			clearInterval(this._tilesPreFetcher);
+		if (this._preFetchIdle)
+			clearTimeout(this._preFetchIdle);
 		if (resetBorder) {
 			this._preFetchBorder = null;
 		}
@@ -1279,6 +1284,7 @@ L.GridLayer = L.Layer.extend({
 		this._preFetchPart = this._selectedPart;
 		this._preFetchIdle = setTimeout(L.bind(function () {
 			this._tilesPreFetcher = setInterval(L.bind(this._preFetchTiles, this), interval);
+			this._prefetchIdle = undefined;
 		}, this), idleTime);
 	}
 });


More information about the Libreoffice-commits mailing list