From d020e8f6666187f24b5656636042dc7154308ed9 Mon Sep 17 00:00:00 2001 From: ahocevar Date: Tue, 25 Jun 2013 02:29:58 -0700 Subject: [PATCH] Merge pull request #1018 from ahocevar/tilemanager-image-only UTFGrid examples broken because of TileManager. r=@bartvde --- lib/OpenLayers/TileManager.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/TileManager.js b/lib/OpenLayers/TileManager.js index 6904b15624..8e9fc020ce 100644 --- a/lib/OpenLayers/TileManager.js +++ b/lib/OpenLayers/TileManager.js @@ -8,6 +8,8 @@ * @requires OpenLayers/Util.js * @requires OpenLayers/BaseTypes.js * @requires OpenLayers/BaseTypes/Element.js + * @requires OpenLayers/Layer/Grid.js + * @requires OpenLayers/Tile/Image.js */ /** @@ -300,13 +302,18 @@ OpenLayers.TileManager = OpenLayers.Class({ * evt - {Object} The listener argument */ addTile: function(evt) { - evt.tile.events.on({ - beforedraw: this.queueTileDraw, - beforeload: this.manageTileCache, - loadend: this.addToCache, - unload: this.unloadTile, - scope: this - }); + if (evt.tile instanceof OpenLayers.Tile.Image) { + evt.tile.events.on({ + beforedraw: this.queueTileDraw, + beforeload: this.manageTileCache, + loadend: this.addToCache, + unload: this.unloadTile, + scope: this + }); + } else { + // Layer has the wrong tile type, so don't handle it any longer + this.removeLayer({layer: evt.tile.layer}); + } }, /**