[Commits] r1754 - in sandbox/ahocevar/playground: trunk/geoext/lib/GeoExt/data ux/Printing/ux/widgets/form

commits at geoext.org commits at geoext.org
Fri Jan 15 12:35:42 CET 2010


Author: ahocevar
Date: 2010-01-15 12:35:42 +0100 (Fri, 15 Jan 2010)
New Revision: 1754

Modified:
   sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
   sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js
Log:
autoFit fixes

Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-15 11:20:01 UTC (rev 1753)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-15 11:35:42 UTC (rev 1754)
@@ -177,11 +177,16 @@
      *      be at least as large as the visible map extent. Default is false.
      * 
      *  Fits the page layout to the current map extent, using the smallest
-     *  scale that entirely fits the extent.
+     *  scale that entirely fits the extent. If the map has not been centered
+     *  yet, this will do nothing.
      */
     fit: function(map, loose) {
+        var center = map.getCenter();
+        if(!center) {
+            return;
+        }
         this.suspendEvents();
-        this.setCenter(map.getCenter());
+        this.setCenter(center);
         this.resumeEvents();
         var extent = map.getExtent();
         var units = map.baseLayer.units;

Modified: sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js	2010-01-15 11:20:01 UTC (rev 1753)
+++ sandbox/ahocevar/playground/ux/Printing/ux/widgets/form/SimplePrint.js	2010-01-15 11:35:42 UTC (rev 1754)
@@ -135,14 +135,7 @@
                 scope: this,
                 single: true
             });
-        }
-        
-        if(this.autoFit === true) {
-            this.mapPanel.map.events.on({
-                "moveend": this.onMoveend,
-                scope: this
-            })
-        }
+        }        
     },
     
     /** private: method[initForm]
@@ -211,6 +204,14 @@
         });
 
         this.doLayout();
+
+        if(this.autoFit === true) {
+            this.onMoveend();
+            this.mapPanel.map.events.on({
+                "moveend": this.onMoveend,
+                scope: this
+            })
+        }
     },
     
     /** private: method[onMoveend]



More information about the Commits mailing list