Changeset 283


Ignore:
Timestamp:
03/26/09 22:43:28 (8 years ago)
Author:
tschaub
Message:

If a map panel is rendered inside of a parent container, it will listen for move events on the parent. This allows us to clear the map's cached offsets. r=bartvde (closes #32)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js

    r272 r283  
    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
     
    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    /**
     
    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
Note: See TracChangeset for help on using the changeset viewer.