[Commits] r1841 - in sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt: data plugins

commits at geoext.org commits at geoext.org
Fri Jan 29 01:36:35 CET 2010


Author: ahocevar
Date: 2010-01-29 01:36:35 +0100 (Fri, 29 Jan 2010)
New Revision: 1841

Modified:
   sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
   sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/plugins/PrintPageField.js
Log:
fixed issue with rotation and rotation field enabled/disabled update

Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-28 23:31:14 UTC (rev 1840)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-29 00:36:35 UTC (rev 1841)
@@ -140,11 +140,13 @@
     
     /** api: method[setRotation]
      *  :param rotation: ``Float`` The new rotation.
+     *  :param force: ``Boolean`` If set to true, the rotation will also be
+     *      set when the layout does not support it. Default is false.
      *  
      *  Sets a new rotation for the page geometry.
      */
-    setRotation: function(rotation) {
-        if(this.printProvider.layout.get("rotation") === true) {
+    setRotation: function(rotation, force) {
+        if(force || this.printProvider.layout.get("rotation") === true) {
             var geom = this.feature.geometry;
             geom.rotate(this.rotation - rotation, geom.getCentroid());
             this.updateFeature(geom, {rotation: rotation});
@@ -254,7 +256,7 @@
      */
     onLayoutChange: function() {
         if(this.printProvider.layout.get("rotation") === false) {
-            this.rotation = 0;
+            this.setRotation(0, true);
         }
         this.setScale(this.scale);
     },

Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/plugins/PrintPageField.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/plugins/PrintPageField.js	2010-01-28 23:31:14 UTC (rev 1840)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/plugins/PrintPageField.js	2010-01-29 00:36:35 UTC (rev 1841)
@@ -107,6 +107,10 @@
             "change": this.onPageChange,
             scope: this
         });
+        this.printPage.printProvider.on({
+            "layoutchange": this.onLayoutChange,
+            scope: this
+        });
     },
 
     /** private: method[onFieldChange]
@@ -143,18 +147,30 @@
                 t.setValue(printPage.scale.get(t.displayField));
             } else if(t.name == "rotation") {
                 t.setValue(printPage.rotation);
-                t.setDisabled(!printPage.printProvider.layout.get("rotation"));
             }
             t.resumeEvents();
         }
     },
     
+    /** private: method[onPageChange]
+     *  :param printProvider: :class:`GeoExt.data.PrintProvider`
+     *  :param layout: ``Ext.Record``
+     *  
+     *  Handler for the "layoutchange" event of the printProvider.
+     */
+    onLayoutChange: function(printProvider, layout) {
+        var t = this.target;
+        t.name == "rotation" && t.setDisabled(!layout.get("rotation"));
+    },
+    
     /** private: method[destroy]
      */
     destroy: function() {
         this.target.un("select", this.onFieldChange, this);
         this.target.un("valid", this.onFieldChange, this);
         this.printPage.un("change", this.onPageChange, this);
+        this.printPage.printProvider.un("layoutchange", this.onLayoutChange,
+            this);
         GeoExt.plugins.PrintPageField.superclass.destroy.apply(this, arguments);
     }
 



More information about the Commits mailing list