haxiomic / firefox-multi-touch-zoom

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

Key Mapping Issues on Windows #1

Open ahoho opened 6 years ago

ahoho commented 6 years ago

Hey -- just thought I'd let you know that it seems to work on Windows, but only when you use two-finger scrolling while pressing the shift key. Pinching on the touchpad and using the touchscreen don't appear to work.

I believe touchpad pinching is interpreted as using the mousewheel w/ control, but I'm not sure.

The touchscreen, on the other hand, seems to be calling cmd_fullZoomReduce (or Enlarge, as the case may be), as named under the browser.gesture.pinch.in preference.

haxiomic commented 6 years ago

Ahh, I was wondering if this was the case, thanks for testing and reporting! I'll see if it's possible to override the default pinch binding

I've just spotted that the page gets offset a little when the scrollbar appears after zooming on Windows so I'll try and fix that too

haxiomic commented 6 years ago

I've done some investigating: since the new WebExtensions API it's not possible to override the exisiting browser.gesture.pinch settings or catch the cmd_fullZoomReduce actions.

However, there could be a work around: bundle a native app with the add-on and use that to modify Firefox's settings.

Does it work if you manually remove the browser.gesture.pinch.in bindings? If it does, then the native approach will work, otherwise we're out of luck

ahoho commented 6 years ago

Is there something that I should bind it to instead? If I simply remove it, unfortunately the gesture does nothing. Touchpad pinching and touchscreen pinching map to different things, though. No idea how touchpad pinching gets mapped in the first place, though.

haxiomic commented 6 years ago

Thanks for trying that @ahoho, If nothing happens when you set the bind to nothing and tried the gesture, that indicates it's not possible to override the current behavior with an add-on. I'll investigate if there's potential for making this a built-in feature but it'd take a long time before it reaches users

It'll be interesting to see if google maps pinch-zooming works on Windows Firefox because that (as far as I can tell) uses the wheel + ctrl trick

remisharrock commented 6 years ago

@haxiomic google maps pinch-zooming works on Windows Firefox Computer with touch screen : HP spectre X360 Windows 10 education version 1709 Firefox version 57.0.2 64 bits Hope to get this touch scale zoom feature soon, it's a deal breaker for me too ! Thank you so much for your work, looks promising !

haxiomic commented 6 years ago

@remisharrock Thanks, it's interesting that google maps has a solution for pinch-to-zoom on Windows. That implies there's another trick I'm missing. I'm going to try to get some time on a touch screen Windows machine to figure it out

haxiomic commented 6 years ago

I finally got some time on a Windows machine and I now know why it wasn't working: a Ctrl key down event occurs artifically right before the wheel event. The addon was relying of the fact that it knows the real state of the ctrl key was unpressed when the fake-wheel-pinch event occurs and this extra event means it can no longer tell.

Anyhow, try again with the 0.5 version (now available on the addons site).

It still won't work on touch screens, however, I discovered we can capture the touch events and prevent the default cmd_fullZoomEnlarge behaviour so touch screen support is totally possible

ahoho commented 6 years ago

Hey, thanks for all the work on this! I'm unfortunately still not getting touchpad pinch-to-zoom to work on 0.5 (two-finger scrolling with ctrl/shift do work)

remisharrock commented 6 years ago

@haxiomic all right, two-fingers touchpad is scale-zooming; working ! but it is "slow" ? any chance to change the parameters for the zoom to make it "faster" ? CTRL + wheel also SHIFT + wheel also pinch on touch screen don't work. Still on Windows 10 education version 1709 Firefox version 57.0.2 64 bits HP spectre X360 with touch screen

haxiomic commented 6 years ago

Great to hear trackpad pinch now works for you. Sorry about the speed - the number I picked worked with the laptop I tested but I guess it varies between laptops. I'll make an options page to let you configure it.

Touch screen pinch shouldn't yet work but I've established it's possible to get it to work (I'll comment here when it's live)

To change the speed manually in the short term you can download the repository, edit the file extension/pinch-zoom.js and change the value of 'pinchZoomSpeed' to something like 0.06

tuppaacc commented 6 years ago

So I installed 0.5 on surface pro and the touch pad pinch-to-zoom wasn't working (it keep using the regular zoom, tried reinstalling it a couple times) so after reading your comment above I went to google maps and whala! is now working, weird, any idea? is like that page triggered something that made it work. btw there are certain websites where IT DOES NOT WORK like the addons page, there it reverts back to using the standard zoom. The zoom speed is good and for some reason pinch to zoon (touch) is a lot smoother, I uninstalled it and I noticed is more zoom is more choppy without it

haxiomic commented 6 years ago

Hey @tuppaacc, not sure why google maps made it work. In the case of the addons page, all addons are disabled on the addons site as a feature of Firefox so it can never work there but it should work everywhere else. I'll try and get some time on a surface pro to see if I can reproduce the issues you had