bubble up the setPosition into the main Tile class. then let subclasses override it if they need to do special things (as in the case of Image).

git-svn-id: http://svn.openlayers.org/trunk/openlayers@173 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-19 14:11:56 +00:00
parent 519fb6da15
commit 70a702a9b0
2 changed files with 14 additions and 3 deletions

View File

@@ -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
*/

View File

@@ -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";
}
},