From 2ff5aee63e3186de709d64982f1686bbbfac4126 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 29 Mar 2011 13:24:15 +0000 Subject: [PATCH] better doc strings for the pixelTolerance option of Handler.Point, plus code styling, no functional change git-svn-id: http://svn.openlayers.org/trunk/openlayers@11747 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Handler/Point.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers/Handler/Point.js b/lib/OpenLayers/Handler/Point.js index 9e039d3303..fca102ebff 100644 --- a/lib/OpenLayers/Handler/Point.js +++ b/lib/OpenLayers/Handler/Point.js @@ -98,11 +98,11 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { /** * APIProperty: pixelTolerance - * {Number} Maximum number of pixels between mouseup and mousedown for an - * event to be considered a click. Default is 5. If set to an - * integer value, clicks with a drag greater than the value will be - * ignored. This property can only be set when the handler is - * constructed. + * {Number} Maximum number of pixels between down and up (mousedown + * and mouseup, or touchstart and touchend) for the handler to + * add a new point. If set to an integer value, if the + * displacement between down and up is great to this value + * no point will be added. Default value is 5. */ pixelTolerance: 5, @@ -420,7 +420,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { this.last = evt.xy; if (this.timerId && - this.passesTolerance(last, evt.xy, this.dblclickTolerance)) { + this.passesTolerance(last, evt.xy, this.dblclickTolerance)) { this.isDblclick = true; // a valid touch immediately adds a component and leaves us with a // complete geometry @@ -521,7 +521,7 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { down: function(evt) { this.mouseDown = true; this.lastDown = evt.xy; - if (!this.touch) { + if(!this.touch) { // no point displayed until up on touch devices this.modifyFeature(evt.xy); } this.stoppedDown = this.stopDown; @@ -540,7 +540,8 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { * {Boolean} Allow event propagation */ move: function (evt) { - if(!this.touch && (!this.mouseDown || this.stoppedDown)) { + if(!this.touch // no point displayed until up on touch devices + && (!this.mouseDown || this.stoppedDown)) { this.modifyFeature(evt.xy); } return true; @@ -567,11 +568,11 @@ OpenLayers.Handler.Point = OpenLayers.Class(OpenLayers.Handler, { } // ignore double-clicks if (this.lastUp && this.passesTolerance(this.lastUp, evt.xy, - this.dblclickTolerance)) { + this.dblclickTolerance)) { return true; } if (this.lastDown && this.passesTolerance(this.lastDown, evt.xy, - this.pixelTolerance)) { + this.pixelTolerance)) { if (this.touch) { this.modifyFeature(evt.xy); }