[Commits] r1752 - sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Fri Jan 15 02:55:18 CET 2010


Author: ahocevar
Date: 2010-01-15 02:55:17 +0100 (Fri, 15 Jan 2010)
New Revision: 1752

Modified:
   sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
Log:
fixed layoutchange handler

Modified: sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js
===================================================================
--- sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-15 01:06:16 UTC (rev 1751)
+++ sandbox/ahocevar/playground/trunk/geoext/lib/GeoExt/data/PrintPage.js	2010-01-15 01:55:17 UTC (rev 1752)
@@ -108,7 +108,7 @@
         ];
         
         this.printProvider.on({
-            "layoutchange": this.updateByHandle,
+            "layoutchange": this.onLayoutChange,
             scope: this
         });
     },
@@ -198,13 +198,17 @@
 
     /** api: method[updateByHandle]
      *  :param handle: ``OpenLayers.Feature.Vector`` the handle to use.
+     *  :param updateHandles: ``Boolean`` If set to false, only the feature
+     *      will be updated, but the handles will not be aligned. Defaults to
+     *      false.
      *  
      *  Updates scale and rotation based on the current handle location. This
      *  method is useful for drag handlers on the handle geometry, when
      *  displayed on a layer.
      */
-    updateByHandle: function(handle) {
+    updateByHandle: function(handle, updateHandles) {
         var handles = this.handles;
+        handle = handle || handles[0];
         var handleIndex = handles.indexOf(handle);
         if(handleIndex === -1) {
             return;
@@ -264,26 +268,26 @@
         
         this.scale = scale;
         this.rotation = rotation;
-        this.updateFeature(geom, false);
+        this.updateFeature(geom, updateHandles === true);
     },
 
     /** private: method[updateFeature]
      *  :param geometry: ``OpenLayers.Geometry`` New geometry for the feature.
      *      If not provided, the existing geometry will be left unchanged.
-     *  :param updateHandle: ``Boolean`` If set to false, only the feature
-     *      will be updated, but the handle will not be aligned. Defaults to
+     *  :param updateHandles: ``Boolean`` If set to false, only the feature
+     *      will be updated, but the handles will not be aligned. Defaults to
      *      true.
      *      
      *  Updates the page feature with a new geometry and aligns the handle
      *  with it.
      */
-    updateFeature: function(geometry, updateHandle) {
+    updateFeature: function(geometry, updateHandles) {
         var f = this.feature;
         geometry.id = f.geometry.id;
         f.geometry = geometry;
         f.layer && f.layer.drawFeature(f);
         
-        if(updateHandle !== false) {
+        if(updateHandles !== false) {
             this.updateHandles();
         }
         this.fireEvent("change", this);
@@ -351,10 +355,17 @@
             center.lon + w, center.lat + h);
     },
     
+    /** private: method[onLayoutChange]
+     *  Handler for the printProvider's layoutchange event.
+     */
+    onLayoutChange: function() {
+        this.updateByHandle(this.handles[0], true);
+    },
+    
     /** private: method[destroy]
      */
     destroy: function() {
-        this.printProvider.un("layoutchange", this.updateByHandle, this);
+        this.printProvider.un("layoutchange", this.onLayoutChange, this);
         GeoExt.data.PrintPage.superclass.destroy.apply(this, arguments);
     }
 



More information about the Commits mailing list