Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #256 from CodeJosch/tileunload

Fire a "tileunload" when tiles removed
  • Loading branch information...
commit d36d4b514c0ddca184884acc91f7d4fc735e3179 2 parents 77d28a7 + 3a6efaa
@mourner mourner authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/layer/tile/TileLayer.js
View
8 src/layer/tile/TileLayer.js
@@ -177,12 +177,16 @@ L.TileLayer = L.Class.extend({
// remove tile if it's out of bounds
if (x < bounds.min.x || x > bounds.max.x || y < bounds.min.y || y > bounds.max.y) {
+ var tile = this._tiles[key];
+ this.fire("tileunload", {tile: tile, url: tile.src});
+
// evil, don't do this! crashes Android 3, produces load errors, doesn't solve memory leaks
// this._tiles[key].src = '';
- if (this._tiles[key].parentNode == this._container) {
- this._container.removeChild(this._tiles[key]);
+ if (tile.parentNode == this._container) {
+ this._container.removeChild(tile);
}
+ // could be tile...?
delete this._tiles[key];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.