Skip to content

(v0.5.1) Failure in TileLayer::_tilesToLoad counter #1565

@lapinos03

Description

@lapinos03

In function :

_removeTile: function (key) {
    var tile = this._tiles[key];

    this.fire("tileunload", {tile: tile, url: tile.src});

    if (this.options.reuseTiles) {
        L.DomUtil.removeClass(tile, 'leaflet-tile-loaded');
        this._unusedTiles.push(tile);

    } else if (tile.parentNode === this._container) {
        this._container.removeChild(tile);
    }

    // for https://github.com/CloudMade/Leaflet/issues/137
    if (!L.Browser.android) {
        tile.src = L.Util.emptyImageUrl;
    }

    delete this._tiles[key];
},

...tile' src is assigned an emptyImageUrl. This will trigger an onLoad event from the navigator, making the _tilesToLoad become negative. _tilesToLoad must be incremented whenever tile.src is given a new value.

    if (!L.Browser.android) {
        if (this.src !== L.Util.emptyImageUrl) {tile.src = L.Util.emptyImageUrl; this._tilesToLoad++;}
    }

Tested in Firefox 19.0.2 & Chrome 26.0.1410.43

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions