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