[OpenLayers-Commits] r11701 - in trunk/openlayers: lib/OpenLayers/Handler tests/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Sat Mar 12 11:04:01 EST 2011


Author: bartvde
Date: 2011-03-12 08:03:57 -0800 (Sat, 12 Mar 2011)
New Revision: 11701

Modified:
   trunk/openlayers/lib/OpenLayers/Handler/Point.js
   trunk/openlayers/tests/Handler/Point.html
Log:
Point Handler should not create feature if it is not active anymore, p=me,erilem r=ahocevar (closes #3172)

Modified: trunk/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-12 02:31:39 UTC (rev 11700)
+++ trunk/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-12 16:03:57 UTC (rev 11701)
@@ -284,7 +284,7 @@
         if(cancel || !this.persist) {
             this.destroyFeature();
         }
-        if(!noNew) {
+        if(!noNew && this.active) {
             this.createFeature();
         }
     },

Modified: trunk/openlayers/tests/Handler/Point.html
===================================================================
--- trunk/openlayers/tests/Handler/Point.html	2011-03-12 02:31:39 UTC (rev 11700)
+++ trunk/openlayers/tests/Handler/Point.html	2011-03-12 16:03:57 UTC (rev 11701)
@@ -25,7 +25,7 @@
     }
 
     function test_Handler_Point_activation(t) {
-        t.plan(10);
+        t.plan(11);
         var log = [];
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
@@ -70,7 +70,15 @@
         activated = handler.deactivate();
         t.ok(activated,
              "deactivate returns true if the handler was active already");
-
+        var failed = false;
+        try {
+            handler.finalize();
+            msg = "finalizing after deactivation does not throw an error";
+        } catch (err) {
+            failed = true;
+            msg = "finalizing after deactivation throws an error";
+        }
+        t.ok(!failed, msg);
         map.destroy();
     }
 



More information about the Commits mailing list