From e6cb15c3f18c73cfc7aea2a797d3a33eedb946cd Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Thu, 18 Feb 2016 19:18:01 -0800 Subject: [PATCH] look for loaded parent tiles in cache This reduces the amount of the view not covered by tiles. It makes tile loading look a lot faster. It helps a lot when you: - zoom in and the pan around - zoom in quickly and then zoom out more slowly ref #1918 --- js/source/tile_pyramid.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/source/tile_pyramid.js b/js/source/tile_pyramid.js index f241a3f9f82..06404013aa3 100644 --- a/js/source/tile_pyramid.js +++ b/js/source/tile_pyramid.js @@ -195,7 +195,12 @@ TilePyramid.prototype = { var tile = this._tiles[coord.id]; if (tile && tile.loaded) { retain[coord.id] = true; - return tile; + return true; + } + if (this._cache.has(coord.id)) { + this.addTile(coord); + retain[coord.id] = true; + return true; } } },