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
This commit is contained in:
Éric Lemoine
2011-03-29 13:24:15 +00:00
parent e92d872a4a
commit 2ff5aee63e

View File

@@ -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);
}