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:
@@ -39,8 +39,12 @@ OpenLayers.Icon.prototype = {
|
|||||||
initialize: function(url, size, offset, calculateOffset) {
|
initialize: function(url, size, offset, calculateOffset) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.size = (size) ? size : new OpenLayers.Size(20,20);
|
this.size = (size) ? size : new OpenLayers.Size(20,20);
|
||||||
this.offset = (offset) ? offset : new OpenLayers.Pixel(0,0);
|
this.offset = offset;
|
||||||
this.calculateOffset = calculateOffset;
|
this.calculateOffset = (calculateOffset) ? calculateOffset
|
||||||
|
: function(size) {
|
||||||
|
return new OpenLayers.Pixel(-(size.w/2),
|
||||||
|
-(size.h/2));
|
||||||
|
};
|
||||||
|
|
||||||
this.imageDiv = OpenLayers.Util.createAlphaImageDiv();
|
this.imageDiv = OpenLayers.Util.createAlphaImageDiv();
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user