Changeset 3628
- Timestamp:
- 07/06/07 16:15:42 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/euzuro/untiled3/lib/OpenLayers/Layer/Grid.js
r3613 r3628 87 87 var row = this.grid[iRow]; 88 88 for(var iCol=0; iCol < row.length; iCol++) { 89 row[iCol].destroy(); 89 var tile = row[iCol]; 90 this.removeTileMonitoringHooks(tile); 91 tile.destroy(); 90 92 } 91 93 } … … 277 279 addTileMonitoringHooks: function(tile) { 278 280 279 var onLoadStart = function() { 280 281 //if there are no tiles loading then trigger a 'loadstart' 282 // event on the layer 281 tile.onLoadStart = function() { 282 //if that was first tile then trigger a 'loadstart' on the layer 283 283 if (this.numLoadingTiles == 0) { 284 284 this.events.triggerEvent("loadstart"); … … 286 286 287 287 this.numLoadingTiles++; 288 289 288 }; 290 tile.events.register("loadstart", 291 this, 292 onLoadStart.bindAsEventListener(this)); 289 tile.events.register("loadstart", this, tile.onLoadStart); 293 290 294 varonLoadEnd = function() {291 tile.onLoadEnd = function() { 295 292 this.numLoadingTiles--; 293 //if that was the last tile, then trigger a 'loadend' on the layer 296 294 if (this.numLoadingTiles == 0) { 297 295 this.events.triggerEvent("loadend"); 298 296 } 299 297 }; 300 tile.events.register("loadend", 301 this, 302 onLoadEnd.bindAsEventListener(this)); 303 }, 304 305 298 tile.events.register("loadend", this, tile.onLoadEnd); 299 }, 300 301 302 303 /** 304 * Method: removeTileMonitoringHooks 305 * This function takes a tile as input and removes the tile hooks 306 * that were added in addTileMonitoringHooks() 307 * 308 * Parameters: 309 * tile - {<OpenLayers.Tile>} 310 */ 311 removeTileMonitoringHooks: function(tile) { 312 tile.events.register("loadstart", this, tile.onLoadStartTile); 313 tile.events.register("loadend", this, tile.onLoadEndTile); 314 }, 315 306 316 /** 307 317 * Method: initGriddedTiles … … 393 403 var row = this.grid.pop(); 394 404 for (var i=0, l=row.length; i<l; i++) { 395 row[i].destroy(); 405 var tile = row[i]; 406 this.removeTileMonitoringHooks(tile) 407 tile.destroy(); 396 408 } 397 409 } … … 402 414 var row = this.grid[i]; 403 415 var tile = row.pop(); 416 this.removeTileMonitoringHooks(tile); 404 417 tile.destroy(); 405 418 }
