move 'image' member from marker down to Icon.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@446 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -15,6 +15,9 @@ OpenLayers.Icon.prototype = {
|
||||
* @type OpenLayers.Pixel */
|
||||
offset: null,
|
||||
|
||||
/** @type DOMElement */
|
||||
image: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
@@ -27,6 +30,13 @@ OpenLayers.Icon.prototype = {
|
||||
this.url = url;
|
||||
this.offset = (offset) ? offset
|
||||
: new OpenLayers.Pixel(0,0);
|
||||
|
||||
this.image = OpenLayers.Util.createAlphaImageDiv(null,
|
||||
null,
|
||||
this.size,
|
||||
this.url,
|
||||
"absolute"
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -37,6 +47,28 @@ OpenLayers.Icon.prototype = {
|
||||
return new OpenLayers.Icon(this.size, this.url, this.offset);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} px
|
||||
*
|
||||
* @return A new DOM Image of this icon set at the location passed-in
|
||||
* @type DOMElement
|
||||
*/
|
||||
draw: function(px) {
|
||||
this.moveTo(px);
|
||||
return this.image;
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Pixel} px
|
||||
*/
|
||||
moveTo: function (px) {
|
||||
if ((px != null) && (this.image != null)) {
|
||||
offsetPx = px.offset(this.offset);
|
||||
this.image.style.left = offsetPx.x + "px";
|
||||
this.image.style.top = offsetPx.y + "px"
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Icon"
|
||||
};
|
||||
Reference in New Issue
Block a user