Made dynmap's javascript self-contained, which allows for multiple maps on a single page.

This commit is contained in:
FrozenCow 2011-01-14 20:08:23 +01:00
parent 77b0bc1664
commit dfe33efdc3
5 changed files with 333 additions and 306 deletions

View file

@ -26,9 +26,9 @@ KzedProjection.prototype = {
}
};
KzedMapType.prototype = new DynMapType();
function KzedMapType() {}
KzedMapType.prototype = {
__proto__: new DynMapType(),
constructor: KzedMapType,
projection: new KzedProjection(),
tileSize: new google.maps.Size(128, 128),
@ -98,7 +98,7 @@ KzedMapType.prototype = {
}
if (tileName) {
img = $('<img/>')
.attr('src', getTileUrl(tileName))
.attr('src', this.dynmap.getTileUrl(tileName))
.error(function() { img.hide(); })
.css({
width: imgSize + 'px',
@ -108,14 +108,15 @@ KzedMapType.prototype = {
marginTop: offset.y + 'px'
})
.appendTo(tile);
registerTile(this, tileName, img);
this.dynmap.registerTile(this, tileName, img);
} else {
unregisterTile(this, tileName);
this.dynmap.unregisterTile(this, tileName);
}
return tile.get(0);
},
};
DefaultMapType.prototype = new KzedMapType();
DefaultMapType.prototype.constructor = DefaultMapType;
function DefaultMapType(){}