OpenLayers OpenLayers

Changeset 4927

Show
Ignore:
Timestamp:
10/11/07 21:36:12 (1 year ago)
Author:
crschmidt
Message:

"In Feature.js the popup is always newly created, instead of reusing the
existing popup.", reported by (and original fix provided by) Bart. Patch
reworked, and tests modified to accomodate for destruction of popup. (Closes
#815)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Feature.js

    r4225 r4927  
    180180            var anchor = (this.marker) ? this.marker.icon : null; 
    181181 
    182             this.popup = new this.popupClass(id,  
    183                                              this.lonlat, 
    184                                              this.data.popupSize, 
    185                                              this.data.popupContentHTML, 
    186                                              anchor,  
    187                                              closeBox);  
    188              
     182            if (!this.popup) { 
     183                this.popup = new this.popupClass(id,  
     184                                                 this.lonlat, 
     185                                                 this.data.popupSize, 
     186                                                 this.data.popupContentHTML, 
     187                                                 anchor,  
     188                                                 closeBox);  
     189            }     
    189190            if (this.data.overflow != null) { 
    190191                this.popup.contentDiv.style.overflow = this.data.overflow; 
     
    205206     */ 
    206207    destroyPopup: function() { 
    207         this.popup.feature = null; 
    208         this.popup.destroy()  
     208        if (this.popup) { 
     209            this.popup.feature = null; 
     210            this.popup.destroy(); 
     211            this.popup = null; 
     212        }     
    209213    }, 
    210214 
  • trunk/openlayers/tests/test_Feature.html

    r4302 r4927  
    122122 
    123123    function test_04_Feature_createPopup(t) { 
    124         t.plan(17); 
     124        t.plan(11); 
    125125 
    126126    //no lonlat         
     
    188188         
    189189        OpenLayers.Feature.prototype.destroyPopup.apply(f, []); 
    190         t.ok(f.popup.feature == null, "popup's 'feature' property nullified on destroy"); 
     190        t.ok(f.popup == null, "popup property nullified on destroy"); 
    191191    } 
    192192