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:
@@ -234,7 +234,7 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
|||||||
this.passesTolerance(this.lastTouchPx, evt.xy, this.dblclickTolerance)) {
|
this.passesTolerance(this.lastTouchPx, evt.xy, this.dblclickTolerance)) {
|
||||||
// double-tap, finalize the geometry
|
// double-tap, finalize the geometry
|
||||||
this.lastTouchPx = evt.xy; // for up() to detect dblclick and do nothing
|
this.lastTouchPx = evt.xy; // for up() to detect dblclick and do nothing
|
||||||
this.finishTouchGeometry();
|
this.finishGeometry();
|
||||||
window.clearTimeout(this.timerId);
|
window.clearTimeout(this.timerId);
|
||||||
this.timerId = null;
|
this.timerId = null;
|
||||||
return false;
|
return false;
|
||||||
@@ -336,14 +336,6 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, {
|
|||||||
return !this.stopUp;
|
return !this.stopUp;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Method: finishTouchGeometry
|
|
||||||
* Finish the geometry and send it back to the control.
|
|
||||||
*/
|
|
||||||
finishTouchGeometry: function() {
|
|
||||||
this.finishGeometry();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: finishGeometry
|
* APIMethod: finishGeometry
|
||||||
* Finish the geometry and send it back to the control.
|
* Finish the geometry and send it back to the control.
|
||||||
|
|||||||
@@ -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.
|
* Finish the geometry and send it back to the control.
|
||||||
*/
|
*/
|
||||||
finishTouchGeometry: function() {
|
finishGeometry: function() {
|
||||||
var index = this.line.geometry.components.length - 2;
|
var index = this.line.geometry.components.length - 2;
|
||||||
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
this.line.geometry.removeComponent(this.line.geometry.components[index]);
|
||||||
this.removePoint();
|
this.removePoint();
|
||||||
@@ -293,24 +293,5 @@ OpenLayers.Handler.Polygon = OpenLayers.Class(OpenLayers.Handler.Path, {
|
|||||||
return geometry;
|
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"
|
CLASS_NAME: "OpenLayers.Handler.Polygon"
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user