diff --git a/lib/OpenLayers/Tile.js b/lib/OpenLayers/Tile.js index a011659db0..4b43603757 100644 --- a/lib/OpenLayers/Tile.js +++ b/lib/OpenLayers/Tile.js @@ -50,6 +50,15 @@ OpenLayers.Tile.prototype = { remove:function() { }, + /** This should be overridden by subclasses if they have special needs + * + * @param OpenLayers.Pixel + */ + setPosition:function(pixel) { + this.position = pixel; + }, + + /** * @type OpenLayers.Pixel */ diff --git a/lib/OpenLayers/Tile/Image.js b/lib/OpenLayers/Tile/Image.js index 7618b79ee5..c2fca4d584 100644 --- a/lib/OpenLayers/Tile/Image.js +++ b/lib/OpenLayers/Tile/Image.js @@ -33,10 +33,12 @@ OpenLayers.Tile.Image.prototype = * @param OpenLayers.Pixel */ setPosition:function(pixel) { + OpenLayers.Tile.prototype.setPosition.apply(this, arguments); + + //update the image's location if (this.img) { - this.img.style.top = pixel.y + "px"; - this.img.style.left = pixel.x + "px"; - this.position = pixel; + this.img.style.top = this.position.y + "px"; + this.img.style.left = this.position.x + "px"; } },