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:
@@ -276,11 +276,21 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
|||||||
}
|
}
|
||||||
return true;
|
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
|
* Method: dblclick
|
||||||
* Handle double-clicks. Finish the geometry and send it back
|
* Handle double-clicks.
|
||||||
* to the control.
|
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* evt - {Event} The browser event
|
* evt - {Event} The browser event
|
||||||
@@ -290,10 +300,7 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
|||||||
*/
|
*/
|
||||||
dblclick: function(evt) {
|
dblclick: function(evt) {
|
||||||
if(!this.freehandMode(evt)) {
|
if(!this.freehandMode(evt)) {
|
||||||
var index = this.line.geometry.components.length - 1;
|
this.finishGeometry();
|
||||||
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
|
||||||
this.removePoint();
|
|
||||||
this.finalize();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user