From a84c6b9302588ad8f587c89ad92abed7826144dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 30 Mar 2011 14:26:12 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Handler/Path.js | 12 ++---------- lib/OpenLayers/Handler/Polygon.js | 23 ++--------------------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/lib/OpenLayers/Handler/Path.js b/lib/OpenLayers/Handler/Path.js index 20d997332c..f3cd75eb99 100644 --- a/lib/OpenLayers/Handler/Path.js +++ b/lib/OpenLayers/Handler/Path.js @@ -25,7 +25,7 @@ OpenLayers.Handler.Path = OpenLayers.Class(OpenLayers.Handler.Point, { * {} */ line: null, - + /** * Property: freehand * {Boolean} In freehand mode, the handler starts the path on mouse down, @@ -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. diff --git a/lib/OpenLayers/Handler/Polygon.js b/lib/OpenLayers/Handler/Polygon.js index 3a57d28186..7b1a00218f 100644 --- a/lib/OpenLayers/Handler/Polygon.js +++ b/lib/OpenLayers/Handler/Polygon.js @@ -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" });