OpenLayers OpenLayers

Ticket #815: Feature.patch

File Feature.patch, 1.1 kB (added by bartvde, 2 years ago)

patch to reuse Popup in Feature

  • /data/home/bart/Feature.js

    old new  
    139139             
    140140            var id = this.id + "_popup"; 
    141141            var anchor = (this.marker) ? this.marker.icon : null; 
    142  
    143             this.popup = new OpenLayers.Popup.AnchoredBubble(id,  
     142             
     143            if (!this.popup) { 
     144              this.popup = new OpenLayers.Popup.AnchoredBubble(id,  
    144145                                                    this.lonlat, 
    145146                                                    this.data.popupSize, 
    146147                                                    this.data.popupContentHTML, 
    147148                                                    anchor, closeBox);  
     149            } 
    148150        }         
    149151        return this.popup; 
    150152    }, 
     
    154156     *   should also be able to override the destruction 
    155157     */ 
    156158    destroyPopup: function() { 
    157         this.popup.destroy()  
     159        if (this.popup) { 
     160          this.popup.destroy();  
     161        } 
     162        this.popup = null; 
    158163    }, 
    159164     
    160165    /** @final @type String */