firefox-multi-touch-zoom
firefox-multi-touch-zoom copied to clipboard
Allow double-tap to zoom out
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.)
would this override Firefox default double tap to select feature?
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.
I've implemented a simple options page on another branch which enables toggling two functionalities:

Should I start another PR or merge it into this one? 🐙
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
- Support double-tap 1 finger but disable it by default
- To prevent spurious text-selection we could forcefully deselect any text that was selected by the gesture
- A hidden fullscreen element could be used to capture the click event before anything responds to it (but this may behave strangely with other pages)
- Same as above, enabled by default but with a modifier key like
shift - Come up with another gesture or a way of capturing two-finger gestures
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