haxiomic / firefox-multi-touch-zoom

Smoothly zoom in and out with the multi-touch pinch gesture
MIT License
154 stars 16 forks source link

Allow double-tap to zoom out #10

Open rschiang opened 6 years ago

rschiang commented 6 years ago

This PR adds the double-tap detection to the extension, in the same behavior as Android or iOS.

(Though double two-finger taps could be more feasible under OS X (macOS), W3C touch events are disabled and lacking trackpad support as of Firefox 59; could be done after touchstart and related events are correctly implemented in FF.)

theotheroracle commented 6 years ago

would this override Firefox default double tap to select feature?

rschiang commented 6 years ago

It would only override such action when page is zoomed. (EDIT: Tested on nightly, it wouldn't.)

@haxiomic Beyond the scope of this PR, we could probably make some of the variable e.g. zoom speed to extension configuration page for better customization.

rschiang commented 6 years ago

I've implemented a simple options page on another branch which enables toggling two functionalities:

Screenshot

Should I start another PR or merge it into this one? 🐙

haxiomic commented 6 years ago

Hey @rschiang, great stuff, thanks :), agree regarding a zoom speed setting – that would be a useful feature. Let's merge the PR into a new branch for now while we work out the kinks (I think a new PR is the easiest way to do this)

I've been fiddling with the double-tap interaction for a little while and I think it needs some tweaks – @PiFi is right in that double-tap with a single finger is normally used to select text.

I find I use double-tap to select text fairly often, especially when zoomed-in since the increased scale makes it easier to hit the right spot, so I don't think by default we should change the behavior here

Additionally we've got to make sure the click event is canceled so that the gesture doesn't trigger actions on the page (like trying to zoom in on a link or button)

Solutions I can see at the moment

If we support double-tap to zoom-out we should also support double-tap to zoom-in (like Chrome and mobile), I had some tests with this working with single-finger double-tap by the text selection issue was too annoying