Resolve #609 with Schuyler looking over my shoulder for review. Instead of

always having a calculateOffset (which overwrites offset if it exists), 
always have an offset. If people want calculateOffset, they can add it. 
Reported by David Bitner.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2962 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-04-02 00:39:53 +00:00
parent 16d543a41f
commit d9a99143af

View File

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