[OpenLayers-Commits] r11087 - in sandbox/elemoine/draw-feature: lib/OpenLayers/Handler tests/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 10 05:46:40 EST 2011


Author: erilem
Date: 2011-02-10 02:46:40 -0800 (Thu, 10 Feb 2011)
New Revision: 11087

Modified:
   sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js
   sandbox/elemoine/draw-feature/tests/Handler/Path.html
Log:
path handler - do not call modifyFeature on mousedown

Modified: sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js	2011-02-10 10:46:31 UTC (rev 11086)
+++ sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js	2011-02-10 10:46:40 UTC (rev 11087)
@@ -231,7 +231,6 @@
         }
         this.mouseDown = true;
         this.lastDown = evt.xy;
-        this.modifyFeature(evt.xy);
         if (this.freehandMode(evt)) {
             return false;
         } else {

Modified: sandbox/elemoine/draw-feature/tests/Handler/Path.html
===================================================================
--- sandbox/elemoine/draw-feature/tests/Handler/Path.html	2011-02-10 10:46:31 UTC (rev 11086)
+++ sandbox/elemoine/draw-feature/tests/Handler/Path.html	2011-02-10 10:46:40 UTC (rev 11087)
@@ -93,6 +93,7 @@
         });
         var activated = handler.activate();
         var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
+        handler.mousemove(evt);
         handler.mousedown(evt);
         handler.mouseup(evt);
         var evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
@@ -115,7 +116,7 @@
     }     
 
     function test_callbacks(t) {
-        t.plan(36);
+        t.plan(37);
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
         });
@@ -156,16 +157,20 @@
                   "[activate] correct point");
         t.ok(log.args[1] == handler.line,
              "[activate] correct feature");
+        // mouse move
+        handler.mousemove(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousemove] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousemove] correct feature");
         // mouse down
         handler.mousedown(
             {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        t.eq(logs.length, 1, "[mousedown] called back");
-        log = logs.shift();
-        t.eq(log.type, "modify", "[mousedown] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
-                  "[mousedown] correct point");
-        t.ok(log.args[1] == handler.line,
-             "[mousedown] correct feature");
+        t.eq(logs.length, 0, "[mousedown] not called back");
         // mouse up
         handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
         t.eq(logs.length, 2, "[mouseup] called back twice");
@@ -204,18 +209,17 @@
                   "[mousemove] correct point");
         t.ok(log.args[1] === handler.line,
              "[mousemove] correct feature");
-        // mouse down ("modify")
+        // mouse down
         handler.mousedown({type: "mousedown",
                            xy: new OpenLayers.Pixel(10, 10)});
-        t.eq(logs.length, 1, "[mousedown] called back");
-        log = logs.shift();
+        t.eq(logs.length, 0, "[mousedown] not called back");
         // mouse up ("point", "modify")
         handler.mouseup({type: "mouseup",
                          xy: new OpenLayers.Pixel(10, 10)});
         t.eq(logs.length, 2, "[mouseup] called back twice");
         log = logs.shift();
         log = logs.shift();
-        // mouse down ("modify")
+        // mouse down
         handler.mousedown({type: "mousedown",
                            xy: new OpenLayers.Pixel(10, 10)});
         t.eq(logs.length, 0, "[mousedown] not called back");



More information about the Commits mailing list