[Commits] r2365 - in core/trunk/geoext: lib/GeoExt/plugins tests/lib/GeoExt/plugins

commits at geoext.org commits at geoext.org
Fri Sep 17 07:00:49 CEST 2010


Author: elemoine
Date: 2010-09-17 07:00:48 +0200 (Fri, 17 Sep 2010)
New Revision: 2365

Modified:
   core/trunk/geoext/lib/GeoExt/plugins/PrintExtent.js
   core/trunk/geoext/tests/lib/GeoExt/plugins/PrintExtent.html
Log:
the PrintExtent's TransformFeature box may not be correctly adjusted, tester by asaunier, r=ahocevar (closes #319)

Modified: core/trunk/geoext/lib/GeoExt/plugins/PrintExtent.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/plugins/PrintExtent.js	2010-09-16 14:38:04 UTC (rev 2364)
+++ core/trunk/geoext/lib/GeoExt/plugins/PrintExtent.js	2010-09-17 05:00:48 UTC (rev 2365)
@@ -234,6 +234,14 @@
         this.map.addLayer(this.layer);
         this.map.addControl(this.control);
         this.control.activate();
+
+        // if we have a page and if the map has a center then update the
+        // transform box for that page, in case the transform control
+        // was deactivated when fitPage (and therefore onPageChange)
+        // was called.
+        if (this.page && this.map.getCenter()) {
+            this.updateBox();
+        }
     },
 
     /** api: method[hide]

Modified: core/trunk/geoext/tests/lib/GeoExt/plugins/PrintExtent.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/plugins/PrintExtent.html	2010-09-16 14:38:04 UTC (rev 2364)
+++ core/trunk/geoext/tests/lib/GeoExt/plugins/PrintExtent.html	2010-09-17 05:00:48 UTC (rev 2365)
@@ -193,7 +193,7 @@
             t.plan(1);
 
             var page = {
-                feature: new OpenLayers.Feature(),
+                 feature: new OpenLayers.Feature(),
                  on: function() {},
                  un: function() {},
                  fit: function() {}
@@ -226,8 +226,54 @@
             mapPanel.destroy();
         }
 
+        function test_addPage_after_hide(t) {
+
+            //
+            // We want to test this sequence: hide, addPage, show.
+            // See http://trac.geoext.org/ticket/319
+            //
+
+            t.plan(1);
+
+            // set up
+
+            var map, printExtent, log;
+
+            map = new OpenLayers.Map({
+                div: "map",
+                layers: [
+                    new OpenLayers.Layer("layer", {isBaseLayer: true})
+                ],
+                center: new OpenLayers.LonLat(0, 0),
+                zoom: 5
+            });
+
+            printExtent = new GeoExt.plugins.PrintExtent({
+                printProvider: new GeoExt.data.PrintProvider({
+                    capabilities: printCapabilities
+                })
+            });
+
+            printExtent.init({map: map, on: function() {}});
+
+            // test
+
+            printExtent.hide();
+            printExtent.addPage();
+            printExtent.show();
+
+            var boxGeom = printExtent.control.box.geometry;
+            t.ok(!boxGeom.components[0].equals(new OpenLayers.Geometry.Point(-1, -1)),
+                 "TransformFeature box is ok after show");
+
+            // tear down
+
+            map.destroy();
+        }
+
     </script>
   <body>
     <div id="mappanel"></div>
+    <div id="map" style="width:600px;height:400px"></div>
   </body>
 </html>



More information about the Commits mailing list