[OpenLayers-Commits] r10847 - trunk/openlayers/lib/OpenLayers/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Mon Oct 18 05:46:46 EDT 2010


Author: bartvde
Date: 2010-10-18 02:46:46 -0700 (Mon, 18 Oct 2010)
New Revision: 10847

Modified:
   trunk/openlayers/lib/OpenLayers/Handler/Path.js
Log:
Path handler: create APIFunction from dblclick internals (called finishGeometry) so people can programmatically stop the path handler, r=erilem (closes #2889)

Modified: trunk/openlayers/lib/OpenLayers/Handler/Path.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Path.js	2010-10-18 08:09:56 UTC (rev 10846)
+++ trunk/openlayers/lib/OpenLayers/Handler/Path.js	2010-10-18 09:46:46 UTC (rev 10847)
@@ -276,11 +276,21 @@
         }
         return true;
     },
+
+    /**
+     * APIMethod: finishGeometry
+     * Finish the geometry and send it back to the control.
+     */
+    finishGeometry: function() {
+        var index = this.line.geometry.components.length - 1;
+        this.line.geometry.removeComponent(this.line.geometry.components[index]);
+        this.removePoint();
+        this.finalize();
+    },
   
     /**
      * Method: dblclick 
-     * Handle double-clicks.  Finish the geometry and send it back
-     * to the control.
+     * Handle double-clicks.
      * 
      * Parameters:
      * evt - {Event} The browser event
@@ -290,10 +300,7 @@
      */
     dblclick: function(evt) {
         if(!this.freehandMode(evt)) {
-            var index = this.line.geometry.components.length - 1;
-            this.line.geometry.removeComponent(this.line.geometry.components[index]);
-            this.removePoint();
-            this.finalize();
+            this.finishGeometry();
         }
         return false;
     },



More information about the Commits mailing list