Ticket #32: move.2.patch

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

update map size when owner container moves (version 2)

  • 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: onDestroy 
     173     * Private method called during the destroy sequence. 
     174     */ 
     175    onDestroy: function() { 
     176        if(this.ownerCt) { 
     177            this.ownerCt.un("move", this.updateMapSize, this); 
     178        } 
     179        GeoExt.MapPanel.superclass.onDestroy.apply(this, arguments); 
    148180    } 
     181     
    149182}); 
    150183 
    151184Ext.reg('gx_mappanel', GeoExt.MapPanel);