[Commits] r1766 - in sandbox/redlining/ux/FeatureEditing/ux/widgets: . form

commits at geoext.org commits at geoext.org
Mon Jan 18 15:37:52 CET 2010


Author: adube
Date: 2010-01-18 15:37:52 +0100 (Mon, 18 Jan 2010)
New Revision: 1766

Modified:
   sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
Log:
bug fix, drawFeature reactivation, remove blank labels

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-18 10:32:53 UTC (rev 1765)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-18 14:37:52 UTC (rev 1766)
@@ -123,7 +123,7 @@
            "beforefeaturemodified": this.onModificationStart,
            "featuremodified": this.onModification,
            "afterfeaturemodified": this.onModificationEnd,
-           "featureunselected": this.onFeatureUnselect,
+//           "featureunselected": this.onFeatureUnselect,
             scope: this
         });
     },
@@ -381,6 +381,14 @@
         }
         */
 
+        // if the user clicked on an other feature while adding a new one,
+        // deactivate the draw control.
+        drawControl = this.getActiveDrawControl();
+        if(drawControl) {
+            drawControl.deactivate();
+            this.featureControl.activate();
+        }
+
         var options = {
           autoSave: this.autoSave,
           features: [feature],
@@ -426,7 +434,18 @@
         var feature = (event.geometry) ? event : event.feature;
         // or we could execute commits here also
 
-        if(this.lastDrawControl && feature.layer.selectedFeatures.length != 0) {
+        if(!feature) {
+            return;
+        }
+
+        this.triggerAutoSave();
+
+        if(feature.popup){
+            feature.popup.close();
+            feature.popup = null;
+        }
+
+        if(this.lastDrawControl && this.activeLayer.selectedFeatures.length == 0) {
             this.featureControl.deactivate();
             this.lastDrawControl.activate();
             this.lastDrawControl = null;
@@ -444,6 +463,7 @@
 
         if(feature.popup){
             feature.popup.close();
+            feature.popup = null;
         }
     },
 

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-18 10:32:53 UTC (rev 1765)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-18 14:37:52 UTC (rev 1766)
@@ -199,11 +199,14 @@
      *  Called when the deleteAction is triggered (button pressed).  
      *  Destroy all features from all layers.
      */
-    deleteFeatures: function() {
-        for(var i=0; i<this.features.length; i++) {
-            this.controler.onFeatureUnselect(this.features[i]);
-            this.features[i].layer.destroyFeatures([this.features[i]]);
+    deleteFeatures: function(features) {
+        features = features || this.features;
+
+        for(var i=0; i<features.length; i++) {
+            features[i].layer.destroyFeatures([features[i]]);
         }
+
+        this.features = [];
     },
 
     /** private: method[getActions]
@@ -229,6 +232,10 @@
     save: function() {
         var feature;
 
+        if(this.features && this.features.length == 0) {
+            return;
+        }
+
         if(this.features.length != 1) {
             return;
         } else {
@@ -240,7 +247,7 @@
             if(feature.attributes[this.labelAttribute] != "") {
                 feature.layer.drawFeature(feature); 
             } else {
-                feature.layer.destroyFeatures([feature]);
+                this.deleteFeatures([feature]);
             }
         }
     },



More information about the Commits mailing list