[OpenLayers-Commits] r11077 - sandbox/elemoine/draw-feature/lib/OpenLayers/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 10 05:45:19 EST 2011


Author: erilem
Date: 2011-02-10 02:45:19 -0800 (Thu, 10 Feb 2011)
New Revision: 11077

Modified:
   sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js
Log:
Path handler - detect double-clicks in mouseup, remove the drawing property, and make sure we don't destroy the feature we just added

Modified: sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js	2011-02-10 10:45:09 UTC (rev 11076)
+++ sandbox/elemoine/draw-feature/lib/OpenLayers/Handler/Path.js	2011-02-10 10:45:19 UTC (rev 11077)
@@ -91,10 +91,10 @@
         );
         this.callback("create", [this.point.geometry, this.getSketch()]);
         this.point.geometry.clearBounds();
-        this.layer.addFeatures([this.line, this.point], {silent: true});
         if(this.persist) {
             this.destroyFeature();
         }
+        this.layer.addFeatures([this.line, this.point], {silent: true});
     },
         
     /**
@@ -215,13 +215,9 @@
      * {Boolean} Allow event propagation
      */
     mousedown: function(evt) {
-        // ignore double-clicks
-        if (this.lastDown && this.lastDown.equals(evt.xy)) {
-            return false;
-        }
-        this.drawing = true;
         this.mouseDown = true;
         this.lastDown = evt.xy;
+        this.modifyFeature(evt.xy);
         if (this.freehandMode(evt)) {
             return false;
         } else {
@@ -261,6 +257,10 @@
      * {Boolean} Allow event propagation
      */
     mouseup: function (evt) {
+        // ignore double-clicks
+        if (this.lastUp && this.lastUp.equals(evt.xy)) {
+            return false;
+        }
         if(this.mouseDown) {
             if(this.freehandMode(evt)) {
                 this.removePoint();



More information about the Commits mailing list