diff --git a/lib/OpenLayers/Icon.js b/lib/OpenLayers/Icon.js index 3d8fb50335..561e992a68 100644 --- a/lib/OpenLayers/Icon.js +++ b/lib/OpenLayers/Icon.js @@ -56,7 +56,8 @@ OpenLayers.Icon = OpenLayers.Class({ /** * Property: px - * {} + * {|Object} An OpenLayers.Pixel or an object + * with a 'x' and 'y' properties. */ px: null, @@ -142,7 +143,8 @@ OpenLayers.Icon = OpenLayers.Class({ * Move the div to the given pixel. * * Parameters: - * px - {} + * px - {|Object} An OpenLayers.Pixel or an + * object with a 'x' and 'y' properties. * * Returns: * {DOMElement} A new DOM Image of this icon set at the location passed-in @@ -161,7 +163,6 @@ OpenLayers.Icon = OpenLayers.Class({ /** * Method: erase * Erase the underlying image element. - * */ erase: function() { if (this.imageDiv != null && this.imageDiv.parentNode != null) { @@ -187,7 +188,8 @@ OpenLayers.Icon = OpenLayers.Class({ * move icon to passed in px. * * Parameters: - * px - {} + * px - {|Object} the pixel position to move to. + * An OpenLayers.Pixel or an object with a 'x' and 'y' properties. */ moveTo: function (px) { //if no px passed in, use stored location @@ -202,8 +204,10 @@ OpenLayers.Icon = OpenLayers.Class({ if (this.calculateOffset) { this.offset = this.calculateOffset(this.size); } - var offsetPx = this.px.offset(this.offset); - OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, offsetPx); + OpenLayers.Util.modifyAlphaImageDiv(this.imageDiv, null, { + x: this.px.x + this.offset.x, + y: this.px.y + this.offset.y + }); } } },