[OpenLayers-Users] textlayer: popups with closebox

Matthias Woltering woltering at gmail.com
Wed Feb 11 17:25:55 EST 2009


Hi,

as far as I know, it's not possible to have closeboxes with a Text
layer. But as you can see in the posting
http://n2.nabble.com/Popup-closebox-and-formatting.-td1824504.html#a1824507
http://n2.nabble.com/Popup-closebox-and-formatting.-td1824504.html#a1824507 

it's possible to create a new class wich inherits from
OpenLayers.Layer.Text. The popup-creation is done with
createPopup(true), so the popup now has a closebox.

The code (from the above posting):

EnhancedTextLayer = OpenLayers.Class.create();
EnhancedTextLayer.prototype = OpenLayers.Class.inherit(
OpenLayers.Layer.Test, {

     /**
      * @param {Event} evt
      */
     markerClick: function(evt) {
         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) {
             this.layer.map.addPopup(this.createPopup(true));
         }
         OpenLayers.Event.stop(evt);
     },

     /** @final @type String */
     CLASS_NAME: "EnhancedTextLayer"
}

This works only partially:
If you close the popup by clicking the marker again, everything is fine.
But if you close the popup by pressing the closebox, it's not possible to
open the popup again. I don't find the reason for this behaviour. Can you
help me?

Thanks,

Matthias
-- 
View this message in context: http://n2.nabble.com/textlayer%3A-popups-with-closebox-tp2311841p2311841.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list