Fix break in namedTile during integrate of updated Leaflet

This commit is contained in:
Mike Primm 2011-08-15 04:44:24 +08:00 committed by mikeprimm
parent 0c9cfedb6e
commit 1aa3d07e6a

View File

@ -107,13 +107,12 @@ var DynmapTileLayer = L.TileLayer.extend({
this._container.appendChild(fragment); this._container.appendChild(fragment);
}, },
//Copy and mod of Leaflet method - marked changes with Dynmap: to simplify reintegration
_addTile: function(tilePoint, container) { _addTile: function(tilePoint, container) {
if(this._container == null) // Ignore if we've stopped being active layer
return;
var tilePos = this._getTilePos(tilePoint), var tilePos = this._getTilePos(tilePoint),
zoom = this._map.getZoom(), zoom = this._map.getZoom(),
key = tilePoint.x + ':' + tilePoint.y, key = tilePoint.x + ':' + tilePoint.y,
name = this.getTileName(tilePoint, zoom), //Dynmap
tileLimit = (1 << zoom); tileLimit = (1 << zoom);
// wrap tile coordinates // wrap tile coordinates
@ -133,9 +132,12 @@ var DynmapTileLayer = L.TileLayer.extend({
// create tile // create tile
var tile = this._createTile(); var tile = this._createTile();
tile.tileName = name; //Dynmap
tile.tilePoint = tilePoint; //Dynmap
L.DomUtil.setPosition(tile, tilePos); L.DomUtil.setPosition(tile, tilePos);
this._tiles[key] = tile; this._tiles[key] = tile;
this._namedTiles[name] = tile; //Dynmap
if (this.options.scheme == 'tms') { if (this.options.scheme == 'tms') {
tilePoint.y = tileLimit - tilePoint.y - 1; tilePoint.y = tileLimit - tilePoint.y - 1;