From 70a702a9b02529dc3cca318d25f9cd50f18f5c32 Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 19 May 2006 14:11:56 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Tile.js | 9 +++++++++ lib/OpenLayers/Tile/Image.js | 8 +++++--- 2 files changed, 14 insertions(+), 3 deletions(-) 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"; } },