Closed Bug 995632 Opened 7 years ago Closed 7 years ago

[camera] zoom gesture sensitivity is depends on screen resolution


(Firefox OS Graveyard :: Gaia::Camera, defect)

Not set


(b2g-v1.4 fixed, b2g-v2.0 fixed)

1.4 S6 (25apr)
Tracking Status
b2g-v1.4 --- fixed
b2g-v2.0 --- fixed


(Reporter: djf, Assigned: justindarc)



(1 file)

The zoom gesture sensitivity (in views/viewfinder.js) uses a constant number of pixels (defined in config/camera.js) to control the sensitivity of pinch-to-zoom gestures on the viewfinder.

The problem with this is that high-resolution devices like the nexus 4 behave differently than low-resolution devices like Hamachi because the screens have different dpi values.

The value of the constant seems tuned to work well on nexus 4, and this means that zooming on hamachi and helix feels slow and laggy, and tends to require multiple pinches.

Possible solutions:

1) switch to gesture detector

2) Get rid of the constant and use the initial distance between the two touches as the value 1.0 and scale everything based on that.  (This is how gesture detector does it.)

3) Modify the sensitivity constant so that it is not a fixed number of pixels, but instead a fraction of the screen width. When the viewfinder view is created, multiply this constant times window.innerWidth and use that as the number of pixels. This would be the easiest option. I think the nexus 4 is 480 CSS pixels wide, so replace the 200px constant with the fraction 200/480.  Then on hamachi and helix this will be multiplied by 320 to get a different pixel value, and zooming should feel the same on all devices.

Want to take this one?

Nominating for 1.4 because this one has the feel of a bug that partners will block on.
blocking-b2g: --- → 1.4?
Flags: needinfo?(jdarcangelo)
Assignee: nobody → jdarcangelo
Flags: needinfo?(jdarcangelo)
Attached file pull-request (master)
David: Here is a PR implementing your suggestion to fix discrepancies with the zoom gesture sensitivity across all devices.
Attachment #8405898 - Flags: review?(dflanagan)
Comment on attachment 8405898 [details] [review]
pull-request (master)

The code is simple, and it works on hamachi, helix and nexus 4.

Unfortunately, it doesn't make much of a difference in the feel of the zoom feature. The nexus4 just seems to have really fast, smooth zoom capability and the other phones are sluggish by comparison. I think this is still a fix we should land, however, and it seems completely safe for 1.4 uplift.

Another issue that makes zooming more difficult on the smaller screen devices is that we don't have integrated event handling for the entire viewfinder, so pinch gestures don't work if they start on top of other buttons or the zoom bar.  I find that when I try to zoom out with a pinch I often put one finger on top of the zoom slider and then my pinch does not get get registered.  On smaller screen devices, there is less of the screen availble for pinching.

Nothing we can do about that problem here, though. I'll file a separate bug for that.
Attachment #8405898 - Flags: review?(dflanagan)
Attachment #8405898 - Flags: review+
Attachment #8405898 - Flags: approval-gaia-v1.4+
Landed on master:
Closed: 7 years ago
Resolution: --- → FIXED
Since this already landed, clearing the nom.
blocking-b2g: 1.4? → ---
You need to log in before you can comment on or make changes to this bug.