better yet, make the defaultIcon() function a static method of the OpenLayers.Marker class.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@443 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-05-29 10:08:55 +00:00
parent 5a95469ef0
commit 0047f3e730

View File

@@ -29,7 +29,7 @@ OpenLayers.Marker.prototype = {
initialize: function(lonlat, icon) {
this.lonlat = lonlat;
this.icon = (icon) ? icon : this.defaultIcon();
this.icon = (icon) ? icon : OpenLayers.Marker.defaultIcon();
this.image = OpenLayers.Util.createAlphaImageDiv(null,
null,
@@ -62,18 +62,21 @@ OpenLayers.Marker.prototype = {
}
},
/**
* @returns A default OpenLayers.Icon to use for a marker
* @type OpenLayers.Icon
*/
defaultIcon: function() {
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
return new OpenLayers.Icon(url, size, offset);
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Marker"
}
};
/**
* @returns A default OpenLayers.Icon to use for a marker
* @type OpenLayers.Icon
*/
OpenLayers.Marker.defaultIcon = function() {
var url = OpenLayers.Util.getImagesLocation() + "marker.png";
var size = new OpenLayers.Size(21, 25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
return new OpenLayers.Icon(url, size, offset);
};