OpenLayers OpenLayers

Changeset 6650

Show
Ignore:
Timestamp:
03/28/08 00:29:40 (10 months ago)
Author:
euzuro
Message:

no need to override and recalculate the relative position in the draw() function. the problem here is that we need to know the relative position for the setSize() function (in order to properly calculate the position-dependent padding). instead of calculating it all over the place, we should only calculate it where it really makes sense: in moveTo(). the solution, then, is calling the moveTo() *before* calling setSize(). not really really a problem though, since the anchored class automatically re-moveTo()s a popup after it has been resized. problem solved.

Files:

Legend:

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

    r6635 r6650  
    281281        } 
    282282 
     283        this.moveTo(px); 
    283284        if (!this.autoSize) { 
    284285            this.setSize(this.size); 
     
    288289        this.setBorder(); 
    289290        this.setContentHTML(); 
    290         this.moveTo(px); 
    291291         
    292292        if (this.panMapIfOutOfView) { 
  • sandbox/euzuro/pop/lib/OpenLayers/Popup/Anchored.js

    r6649 r6650  
    100100        OpenLayers.Popup.prototype.moveTo.apply(this, newArguments); 
    101101    }, 
    102      
    103     /**  
    104      * Method: draw 
    105      *  
    106      * Parameters: 
    107      * px - {<OpenLayers.Pixel>} 
    108      *  
    109      * Returns:  
    110      * {DOMElement} Reference to a div that contains the drawn popup. 
    111      */ 
    112     draw: function(px) { 
    113         if (px == null) { 
    114             if ((this.lonlat != null) && (this.map != null)) { 
    115                 px = this.map.getLayerPxFromLonLat(this.lonlat); 
    116             } 
    117         } 
    118          
    119         //calculate relative position 
    120         this.relativePosition = this.calculateRelativePosition(px); 
    121          
    122         return OpenLayers.Popup.prototype.draw.apply(this, [px]); 
    123     }, 
    124  
    125102 
    126103    /**