[Commits] r2325 - core/trunk/geoext/lib/GeoExt/widgets
commits at geoext.org
commits at geoext.org
Fri Sep 10 15:16:17 CEST 2010
Author: ahocevar
Date: 2010-09-10 15:16:17 +0200 (Fri, 10 Sep 2010)
New Revision: 2325
Modified:
core/trunk/geoext/lib/GeoExt/widgets/PrintMapPanel.js
Log:
make it so preview scales will get calculated properly if there is no ownerCt. r=pgiraud (closes #323)
Modified: core/trunk/geoext/lib/GeoExt/widgets/PrintMapPanel.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/PrintMapPanel.js 2010-09-10 13:14:02 UTC (rev 2324)
+++ core/trunk/geoext/lib/GeoExt/widgets/PrintMapPanel.js 2010-09-10 13:16:17 UTC (rev 2325)
@@ -201,7 +201,7 @@
GeoExt.PrintMapPanel.superclass.initComponent.call(this);
- this.printProvider.on("layoutchange", this.updateExtent, this);
+ this.printProvider.on("layoutchange", this.syncSize, this);
this.printPage.on("change", this.fitZoom, this);
this.map.events.register("moveend", this, this.updatePage);
},
@@ -211,7 +211,21 @@
*/
afterRender: function() {
GeoExt.PrintMapPanel.superclass.afterRender.apply(this, arguments);
- this.updateExtent();
+ this.syncSize();
+ if (this.initialConfig.limitScales === true) {
+ if (!this.ownerCt) {
+ this.calculatePreviewScales();
+ } else {
+ this.ownerCt.on({
+ "afterlayout": {
+ fn: this.calculatePreviewScales,
+ scope: this,
+ single: true
+ }
+ });
+ }
+ this.on("resize", this.calculatePreviewScales, this);
+ }
},
/** private: method[adjustSize]
@@ -249,17 +263,6 @@
return {width: width, height: height};
},
- /** private: method[updateExtent]
- * Makes sure that this :class:`PrintMapPanel` gets the aspect ratio that
- * matches the print page, and update the previewable scales.
- */
- updateExtent: function() {
- this.syncSize();
- if (this.initialConfig.limitScales === true) {
- this.calculatePreviewScales();
- }
- },
-
/** private: method[fitZoom]
* Fits this PrintMapPanel's zoom to the print scale.
*/
@@ -360,7 +363,7 @@
beforeDestroy: function() {
this.map.events.unregister("moveend", this, this.updatePage);
this.printPage.un("change", this.fitZoom, this);
- this.printProvider.un("layoutchange", this.updateExtent, this);
+ this.printProvider.un("layoutchange", this.syncSize, this);
GeoExt.PrintMapPanel.superclass.beforeDestroy.apply(this, arguments);
}
});
More information about the Commits
mailing list