[Commits] r283 - core/trunk/geoext/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Thu Mar 26 22:43:28 CET 2009
Author: tschaub
Date: 2009-03-26 22:43:28 +0100 (Thu, 26 Mar 2009)
New Revision: 283
Modified:
core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js
Log:
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)
Modified: core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js 2009-03-26 21:04:58 UTC (rev 282)
+++ core/trunk/geoext/lib/GeoExt/widgets/MapPanel.js 2009-03-26 21:43:28 UTC (rev 283)
@@ -119,6 +119,16 @@
},
/**
+ * Method: updateMapSize
+ * Tell the map that it needs to recaculate its size and position.
+ */
+ updateMapSize: function() {
+ if(this.map) {
+ this.map.updateSize();
+ }
+ },
+
+ /**
* Method: onRender
* Private method called after the panel has been
* rendered.
@@ -136,6 +146,17 @@
}
}
},
+
+ /**
+ * Method: afterRender
+ * Private method called after the panel has been rendered.
+ */
+ afterRender: function() {
+ GeoExt.MapPanel.superclass.afterRender.apply(this, arguments);
+ if(this.ownerCt) {
+ this.ownerCt.on("move", this.updateMapSize, this);
+ }
+ },
/**
* Method: onResize
@@ -144,8 +165,20 @@
*/
onResize: function() {
GeoExt.MapPanel.superclass.onResize.apply(this, arguments);
- this.map.updateSize();
+ this.updateMapSize();
+ },
+
+ /**
+ * Method: onDestroy
+ * Private method called during the destroy sequence.
+ */
+ onDestroy: function() {
+ if(this.ownerCt) {
+ this.ownerCt.un("move", this.updateMapSize, this);
+ }
+ GeoExt.MapPanel.superclass.onDestroy.apply(this, arguments);
}
+
});
Ext.reg('gx_mappanel', GeoExt.MapPanel);
More information about the Commits
mailing list