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
This commit is contained in:
bartvde
2010-10-18 09:46:46 +00:00
parent 107cf7948c
commit e606386b94

View File

@@ -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;
},