[OpenLayers-Commits] r11747 - trunk/openlayers/lib/OpenLayers/Handler

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Mar 29 09:24:16 EDT 2011


Author: erilem
Date: 2011-03-29 06:24:15 -0700 (Tue, 29 Mar 2011)
New Revision: 11747

Modified:
   trunk/openlayers/lib/OpenLayers/Handler/Point.js
Log:
better doc strings for the pixelTolerance option of Handler.Point, plus code styling, no functional change

Modified: trunk/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-29 12:05:26 UTC (rev 11746)
+++ trunk/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-29 13:24:15 UTC (rev 11747)
@@ -98,11 +98,11 @@
     
     /**
      * 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 @@
         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 @@
     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 @@
      * {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 @@
         }
         // 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);
             }



More information about the Commits mailing list