Commit changes to Anchored popup: add anchor width/height to top left position if we're heading in that direction. I'm still not sure how perfect this is, but it stops the bubbles from being on top of my icons.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@421 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -23,13 +23,11 @@ OpenLayers.Popup.Anchored.prototype =
|
||||
* @param {String} contentHTML
|
||||
*/
|
||||
initialize:function(id, lonlat, size, contentHTML, anchorSize) {
|
||||
|
||||
var newArguments = new Array(id, lonlat, size, contentHTML);
|
||||
OpenLayers.Popup.prototype.initialize.apply(this, newArguments);
|
||||
|
||||
this.anchorSize = (anchorSize != null) ? anchorSize
|
||||
: new OpenLayers.Size(0,0);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -102,14 +100,13 @@ OpenLayers.Popup.Anchored.prototype =
|
||||
* @type OpenLayers.Pixel
|
||||
*/
|
||||
calculateNewPx:function(px) {
|
||||
|
||||
var newPx = px.copyOf();
|
||||
|
||||
var top = (this.relativePosition.charAt(0) == 't');
|
||||
newPx.y += (top) ? -this.size.h : this.anchorSize.h;
|
||||
newPx.y += (top) ? -(this.size.h + this.anchorSize.h) : this.anchorSize.h;
|
||||
|
||||
var left = (this.relativePosition.charAt(1) == 'l');
|
||||
newPx.x += (left) ? -this.size.w : this.anchorSize.w;
|
||||
newPx.x += (left) ? -(this.size.w + this.anchorSize.w) : this.anchorSize.w;
|
||||
|
||||
return newPx;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user