make default behaviour for an icon with no specified offset or calcuateOffset() function be to have a standard calculateOffset() function setting the offset point at the center of the icon

git-svn-id: http://svn.openlayers.org/trunk/openlayers@1553 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2006-10-03 20:51:39 +00:00
parent 526c8a6e1e
commit 91505ff5d6

View File

@@ -39,8 +39,12 @@ OpenLayers.Icon.prototype = {
initialize: function(url, size, offset, calculateOffset) {
this.url = url;
this.size = (size) ? size : new OpenLayers.Size(20,20);
this.offset = (offset) ? offset : new OpenLayers.Pixel(0,0);
this.calculateOffset = calculateOffset;
this.offset = offset;
this.calculateOffset = (calculateOffset) ? calculateOffset
: function(size) {
return new OpenLayers.Pixel(-(size.w/2),
-(size.h/2));
};
this.imageDiv = OpenLayers.Util.createAlphaImageDiv();
},