simplify the code of the path and polygon handlers, removing the finishTouchGeometry function, r=sbrunner (closes #3214)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11793 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-03-30 14:26:12 +00:00
parent 7f45ff559a
commit a84c6b9302
2 changed files with 4 additions and 31 deletions

View File

@@ -234,7 +234,7 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
this.passesTolerance(this.lastTouchPx, evt.xy, this.dblclickTolerance)) {
// double-tap, finalize the geometry
this.lastTouchPx = evt.xy; // for up() to detect dblclick and do nothing
this.finishTouchGeometry();
this.finishGeometry();
window.clearTimeout(this.timerId);
this.timerId = null;
return false;
@@ -336,14 +336,6 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
return !this.stopUp;
},
/**
* Method: finishTouchGeometry
* Finish the geometry and send it back to the control.
*/
finishTouchGeometry: function() {
this.finishGeometry();
},
/**
* APIMethod: finishGeometry
* Finish the geometry and send it back to the control.

View File

@@ -151,10 +151,10 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
},
/**
* Method: finishTouchGeometry
* Method: finishGeometry
* Finish the geometry and send it back to the control.
*/
finishTouchGeometry: function() {
finishGeometry: function() {
var index = this.line.geometry.components.length - 2;
this.line.geometry.removeComponent(this.line.geometry.components[index]);
this.removePoint();
@@ -293,24 +293,5 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
return geometry;
},
/**
* Method: dblclick
* Handle double-clicks. Finish the geometry and send it back
* to the control.
*
* Parameters:
* evt - {Event}
*/
dblclick: function(evt) {
if(!this.freehandMode(evt)) {
// remove the penultimate point
var index = this.line.geometry.components.length - 2;
this.line.geometry.removeComponent(this.line.geometry.components[index]);
this.removePoint();
this.finalize();
}
return false;
},
CLASS_NAME: "OpenLayers.Handler.Polygon"
});