JSDOC and small update to use Pixel diff code

git-svn-id: http://svn.openlayers.org/trunk/openlayers@123 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-18 04:37:31 +00:00
parent 50d4546af4
commit 5d80d71f21

View File

@@ -27,16 +27,23 @@ OpenLayers.Marker.prototype = {
this.icon = icon;
this.lonlat = lonlat;
},
/**
* @param {OpenLayers.Pixel} pixel
*
* @return A new DOM Image with this marker<65>s icon set at the
* location passed-in
* @type DOMElement
*/
generateMarker: function(pixel) {
// Create a div here, and set the location to the pixel above modified
// by the icon size.
var markerObject = OpenLayers.Util.createImage(
this.icon.url,
this.icon.size,
new OpenLayers.Pixel(
pixel.x-(this.icon.size.w/2),
pixel.y-this.icon.size.h)
);
var markerOffset = new OpenLayers.Pixel(this.icon.size.w / 2,
this.icon.size.h);
var iconPosition = pixel.diff(markerOffset);
var markerObject = OpenLayers.Util.createImage(this.icon.url,
this.icon.size,
iconPosition);
return markerObject;
}
}