[OpenLayers-Users] Popup.setSize() - any reason why it should break in 2.2?

Nick Whitelegg nick at hogweed.org
Tue Dec 19 19:08:38 EST 2006


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?

Thanks,
Nick

markerClick: function(evt) {
        if(this.layer.deleteTestFunction && this.layer.deleteFunction &&
                this.layer.deleteTestFunction()) {
            this.layer.deleteFunction(this.id);
            this.layer.removeMarker(this.marker);
            this.destroy();
        } else {
            sameMarkerClicked = (this == this.layer.selectedFeature);
            this.layer.selectedFeature = (!sameMarkerClicked) ? this : null;
            for(var i=0; i < this.layer.map.popups.length; i++) {
                this.layer.map.removePopup(this.layer.map.popups[i]);
            }
            if (!sameMarkerClicked) {
                var popup = this.createPopup();
                // This breaks in 2.2
                //popup.setSize(this.layer.popupSize);
                popup.setBackgroundColor(this.layer.popupColour);
                OpenLayers.Event.observe(popup.div, "click",
                function() {
                for(var i=0; i < this.layer.map.popups.length; i++) {
                    this.layer.map.removePopup(this.layer.map.popups[i]);
                  }
                }.bindAsEventListener(this));
                this.layer.map.addPopup(popup);
            }
            OpenLayers.Event.stop(evt);
        }
    },



More information about the Users mailing list