[Commits] r1589 - in sandbox/ahocevar/playground/ux/Printing/ux: data plugins

commits at geoext.org commits at geoext.org
Thu Dec 17 10:38:52 CET 2009


Author: ahocevar
Date: 2009-12-17 10:38:52 +0100 (Thu, 17 Dec 2009)
New Revision: 1589

Modified:
   sandbox/ahocevar/playground/ux/Printing/ux/data/PrintPage.js
   sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintPageField.js
   sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintProviderField.js
Log:
respect rotation setting of the layout

Modified: sandbox/ahocevar/playground/ux/Printing/ux/data/PrintPage.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/data/PrintPage.js	2009-12-15 23:21:37 UTC (rev 1588)
+++ sandbox/ahocevar/playground/ux/Printing/ux/data/PrintPage.js	2009-12-17 09:38:52 UTC (rev 1589)
@@ -159,10 +159,12 @@
      *  Sets a new rotation for the page geometry.
      */
     setRotation: function(rotation) {
-        var geom = this.feature.geometry;
-        geom.rotate(this.rotation - rotation, geom.getCentroid());
-        this.rotation = rotation;
-        this.updateFeature(geom);
+        if(this.printProvider.layout.get("rotation") === true) {
+            var geom = this.feature.geometry;
+            geom.rotate(this.rotation - rotation, geom.getCentroid());
+            this.rotation = rotation;
+            this.updateFeature(geom);
+        }
     },
     
     /** api: method[fitPage]
@@ -196,11 +198,14 @@
     updateByHandle: function(updateHandle) {
         var f = this.feature;
         
-        var hLoc = this.handle.geometry.getBounds().getCenterLonLat();
-        var center = f.geometry.getBounds().getCenterLonLat();
-        var dx = hLoc.lon - center.lon;
-        var dy = hLoc.lat - center.lat;
-        var rotation = Math.round(Math.atan2(dx, dy) * 180 / Math.PI);
+        var rotation = 0;
+        if(this.printProvider.layout.get("rotation") === true) {
+            var hLoc = this.handle.geometry.getBounds().getCenterLonLat();
+            var center = f.geometry.getBounds().getCenterLonLat();
+            var dx = hLoc.lon - center.lon;
+            var dy = hLoc.lat - center.lat;
+            rotation = Math.round(Math.atan2(dx, dy) * 180 / Math.PI);
+        }
 
         var geom = this.handle.geometry;
         var dist = f.geometry.getCentroid().distanceTo(geom);

Modified: sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintPageField.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintPageField.js	2009-12-15 23:21:37 UTC (rev 1588)
+++ sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintPageField.js	2009-12-17 09:38:52 UTC (rev 1589)
@@ -92,6 +92,7 @@
             t.setValue(page.scale.get(t.displayField));
         } else if(t.name == "rotation") {
             t.setValue(page.rotation);
+            t.setDisabled(!page.printProvider.layout.get("rotation"));
         }
         t.resumeEvents();
     }

Modified: sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintProviderField.js
===================================================================
--- sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintProviderField.js	2009-12-15 23:21:37 UTC (rev 1588)
+++ sandbox/ahocevar/playground/ux/Printing/ux/plugins/PrintProviderField.js	2009-12-17 09:38:52 UTC (rev 1589)
@@ -42,8 +42,8 @@
     init: function(target) {
         this.target = target;
         var onCfg = {
-            "render": this.onRender,
-            scope: this
+            scope: this,
+            "render": this.onRender
         };
         onCfg[target instanceof Ext.form.ComboBox ? "select" : "valid"] =
             this.onFieldChange;



More information about the Commits mailing list