Closed Bug 599145 Opened 14 years ago Closed 14 years ago

Fix double tap radius calculation

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(fennec2.0b1+)

VERIFIED FIXED
Tracking Status
fennec 2.0b1+ ---

People

(Reporter: mbrubeck, Assigned: mbrubeck)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
This patch fixes the following bugs related to TapDouble events:

* The double-click radius depends on the browser scale, while it should be constant in client coordinates.

* clientX1/Y1 and clientX2/Y2 are always the same, so the distance between the two taps is actually ignored.  Regression from http://hg.mozilla.org/mobile-browser/rev/0da42190d7b6

* (After the above bug is fixed) if you tap twice in within 400ms but outside of the 100px radius, both taps are swallowed silently.

This patch fixes the above bugs, and moves the relevant logic from browser.js to input.js.
Attachment #478087 - Flags: review?(webapps)
tracking-fennec: --- → ?
Comment on attachment 478087 [details] [diff] [review]
patch

This patch is awesome! Only one concern here.

>   /** Endpoint of _commitAnotherClick().  Finalize a double tap.  */
>   _doDoubleClick: function _doDoubleClick() {
>     let mouseUp1 = this._downUpEvents[1];
>     // sometimes the second press event is not dispatched at all
>     let mouseUp2 = this._downUpEvents[Math.min(3, this._downUpEvents.length - 1)];
>     this._cleanClickBuffer();
> 
>+    let dx = mouseUp1.clientX - mouseUp2.clientX;
>+    let dy = mouseUp1.clientY - mouseUp2.clientY;
>+
>+    if (dx*dx + dy*dy < kDoubleClickRadius*kDoubleClickRadius) {
>+      this._dispatchTap("TapDouble", mouseUp1);
>+    } else {
>+      this._dispatchTap("TapSingle", mouseUp1);
>+      this._dispatchTap("TapSingle", mouseUp2);
>+    }
>+  },

Sending two single taps is a change in functionality. Although this makes perfect sense, I worry about what this may mean practically. If two taps come in very fast succession, I fear it is either A) a botched double tap or B) some sort of touch glitch. Dispatching two single taps could end up activating links, which probably isn't what the user intended. Is there any particular reason to add this?
tracking-fennec: ? → 2.0b1+
After trying this out on a device for a while, I didn't see any problems with accidental taps or link activations.
Comment on attachment 478087 [details] [diff] [review]
patch

Go go go!
Attachment #478087 - Flags: review?(webapps) → review+
http://hg.mozilla.org/mobile-browser/rev/d389eb72c4a0
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Verified on nightly :
Mozilla/5.0 (Android; Linux armv71; rv2.0b7pre) Gecko/20101007 Firefox/4.0b7pre Fennec/4.0b2pre

Verified on Beta 1:
Mozilla/5.0 (Maemo; Linux armv71; rv:2.0b7pre) Gecko/201001006 Firefox/4.0b7pre Fennec/4.0b1
Mozille/5.0 (Android; Linux armv71; rv:2.0b7pre) Gecko20101006 Firefox/4.0b7pre Fennec/4.0b1
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: