From d5931ad35a55cc00a020f7268b6fab80e1a0e373 Mon Sep 17 00:00:00 2001 From: bennlich Date: Sun, 20 Jul 2014 22:14:30 -0700 Subject: [PATCH 1/2] added _abortLoading() to _reset() --- src/layer/tile/GridLayer.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layer/tile/GridLayer.js b/src/layer/tile/GridLayer.js index cc39f293..0bb181b1 100644 --- a/src/layer/tile/GridLayer.js +++ b/src/layer/tile/GridLayer.js @@ -191,6 +191,10 @@ L.GridLayer = L.Layer.extend({ }); } + if (this._abortLoading) { + this._abortLoading(); + } + this._tiles = {}; this._tilesToLoad = 0; this._tilesTotal = 0; From 412bbd7cdb1ede7af8797fd1a2c4d07b237be8a4 Mon Sep 17 00:00:00 2001 From: bennlich Date: Sun, 20 Jul 2014 22:16:11 -0700 Subject: [PATCH 2/2] always clear tile onload and onerror funs in _abortLoading() --- src/layer/tile/TileLayer.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/layer/tile/TileLayer.js b/src/layer/tile/TileLayer.js index 5c259f59..2e5aa9d5 100644 --- a/src/layer/tile/TileLayer.js +++ b/src/layer/tile/TileLayer.js @@ -143,11 +143,11 @@ L.TileLayer = L.GridLayer.extend({ for (i in this._tiles) { tile = this._tiles[i]; - if (!tile.complete) { - tile.onload = L.Util.falseFn; - tile.onerror = L.Util.falseFn; - tile.src = L.Util.emptyImageUrl; + tile.onload = L.Util.falseFn; + tile.onerror = L.Util.falseFn; + if (!tile.complete) { + tile.src = L.Util.emptyImageUrl; L.DomUtil.remove(tile); } }