Ticket #32: move.patch

File move.patch, 1.9 kB (added by tschaub, 1 year ago)

update map size when owner container moves

  • lib/GeoExt/widgets/MapPanel.js

    old new  
    119119    }, 
    120120     
    121121    /** 
     122     * Method: updateMapSize 
     123     * Tell the map that it needs to recaculate its size and position. 
     124     */ 
     125    updateMapSize: function() { 
     126        if(this.map) { 
     127            this.map.updateSize(); 
     128        } 
     129    }, 
     130     
     131    /** 
    122132     * Method: onRender 
    123133     *     Private method called after the panel has been 
    124134     *     rendered. 
     
    136146            } 
    137147        } 
    138148    }, 
     149     
     150    /** 
     151     * Method: afterRender 
     152     * Private method called after the panel has been rendered. 
     153     */ 
     154    afterRender: function() { 
     155        GeoExt.MapPanel.superclass.afterRender.apply(this, arguments); 
     156        if(this.ownerCt) { 
     157            this.ownerCt.on("move", this.updateMapSize, this); 
     158        } 
     159    },     
    139160 
    140161    /** 
    141162     * Method: onResize 
     
    144165     */ 
    145166    onResize: function() { 
    146167        GeoExt.MapPanel.superclass.onResize.apply(this, arguments); 
    147         this.map.updateSize(); 
     168        this.updateMapSize(); 
     169    }, 
     170     
     171    /** 
     172     * Method: destroy 
     173     * Destroys this component by purging any event listeners, removing the 
     174     *     component's element from the DOM, removing the component from its 
     175     *     container (if applicable) and unregistering it from Ext.ComponentMgr. 
     176     *     Destruction is generally handled automatically by the framework and 
     177     *     this method should usually not need to be called directly. 
     178     */ 
     179    destroy: function() { 
     180        if(this.ownerCt) { 
     181            this.ownerCt.un("move", this.updateMapSize, this); 
     182        } 
     183        GeoExt.MapPanel.superclass.destroy.apply(this, arguments); 
    148184    } 
     185     
    149186}); 
    150187 
    151188Ext.reg('gx_mappanel', GeoExt.MapPanel);