[OpenLayers-Users] Popup.setSize() - any reason why it should
break in 2.2?
Christopher Schmidt
crschmidt at metacarta.com
Thu Dec 21 09:35:11 EST 2006
On Wed, Dec 20, 2006 at 12:08:38AM +0000, Nick Whitelegg wrote:
>
> I've just converted my custom "GeoRSS2" layer (a layer which can handle
> retrieval of GeoRSS features within a bounding box) from OpenLayers 2.1 to
> 2.2. However one line breaks - I can no longer set the size of a popup within
> the markerClick function - I get the error "quadrant has no properties".
>
> My markerClick function is modified from the original GeoRSS.js function to
> handle deleting the marker if a user is in a certain mode, and is as below.
> Full code (if needed) is at http://www.free-map.org.uk/test/GeoRSS2.js.
>
> Is this an API change?
After OpenLayers is loaded on your page, ensure that the following code
is executed (possibly by putting it in a later-loaded js file, or inside
your init() function):
OpenLayers.Popup.AnchoredBubble.prototype.setSize = function(size) {
OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments);
if (this.contentDiv != null) {
var contentSize = this.size.clone();
contentSize.h -= (2 * OpenLayers.Popup.AnchoredBubble.CORNER_SIZE);
contentSize.h -= (2 * this.padding);
this.contentDiv.style.height = contentSize.h + "px";
this.contentDiv.style.width = contentSize.w + "px";
if (this.map) {
//size has changed - must redo corners
this.setRicoCorners(!this.rounded);
this.rounded = true;
}
}
}
This will solve the problem for your application.
Regards,
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list