OpenLayers OpenLayers

Changeset 6630

Show
Ignore:
Timestamp:
03/27/08 02:09:41 (10 months ago)
Author:
euzuro
Message:

setSize need now only update the frames, since all else is in handled in the main Popup class. The one thing we do want to handle correctly, however, is the close div, since it is relative to the bigger group div now we must take into account the padding.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/euzuro/pop/lib/OpenLayers/Popup/Framed.js

    r6522 r6630  
    163163        // This will take care of setting the popup's 'div' and 'contentDiv'  
    164164        //  to the size specified (or the max/min popup size if extreme). 
    165         OpenLayers.Popup.prototype.setSize.apply(this, arguments); 
    166          
    167         // since the 'size' we specified as an argument here is setting the  
    168         //  size of the *content* div, we now need to go back and change  
    169         //  the popup's 'size' property and its main div's dimensions to  
    170         //  reflect the *actual* size of the whole popup (content + padding). 
    171         //  
    172         this.size = this.size.clone(); 
    173          
    174         //this is a workaround since API respect won't let us mandate  
    175         // padding be a Bounds object. This needs to be removed in 3.0 
    176         // 
    177         this.fixPadding(); 
    178              
    179         this.size.w += this.padding.left + this.padding.right; 
    180         this.size.h += this.padding.top + this.padding.bottom; 
    181  
    182         this.div.style.width = this.size.w + "px"; 
    183         this.div.style.height = this.size.h + "px"; 
    184          
    185         if ((this.lonlat) && (this.map)) { 
    186             var px = this.map.getLayerPxFromLonLat(this.lonlat); 
    187             if (px) { 
    188                 this.moveTo(px);            
    189             } 
    190         } 
     165        OpenLayers.Popup.Anchored.prototype.setSize.apply(this, arguments); 
    191166         
    192167        this.updateFrames(); 
     
    247222        //update the position of our close box to new padding 
    248223        if (this.closeDiv) { 
    249             this.closeDiv.style.right = this.padding.right + "px"; 
    250             this.closeDiv.style.top = this.padding.top + "px"; 
     224            // use the content div's css padding to determine if we should 
     225            //  padd the close div 
     226            var contentDivPadding = this.getContentDivPadding(); 
     227 
     228            this.closeDiv.style.right = contentDivPadding.right +  
     229                                        this.padding.right + "px"; 
     230            this.closeDiv.style.top = contentDivPadding.top +  
     231                                      this.padding.top + "px"; 
    251232        }         
    252233    },