From e606386b948de80b2c0e1e697270dea6ef950dd6 Mon Sep 17 00:00:00 2001 From: bartvde Date: Mon, 18 Oct 2010 09:46:46 +0000 Subject: [PATCH] Path handler: create APIFunction from dblclick internals (called finishGeometry) so people can programmatically stop the path handler, r=erilem (closes #2889) git-svn-id: http://svn.openlayers.org/trunk/openlayers@10847 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Handler/Path.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/OpenLayers/Handler/Path.js b/lib/OpenLayers/Handler/Path.js index 689ef3ba70..867e3f4aca 100644 --- a/lib/OpenLayers/Handler/Path.js +++ b/lib/OpenLayers/Handler/Path.js @@ -276,11 +276,21 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, { } 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 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, { */ 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; },