Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multi-touch gestures on OS X #1486

Closed
petrbrzek opened this issue Apr 24, 2015 · 18 comments
Closed

Support for multi-touch gestures on OS X #1486

petrbrzek opened this issue Apr 24, 2015 · 18 comments

Comments

@petrbrzek
Copy link

No description provided.

@zcbenz
Copy link
Member

zcbenz commented Apr 29, 2015

I think Chrome 42 which is used by latest Electron already has some support of it.

@zcbenz zcbenz closed this as completed Apr 29, 2015
@petrbrzek
Copy link
Author

I'm unable to find any information about it. Can you provide some source?

@marekhrabe
Copy link

This will probably be implemented as Touch events, right?

@zcbenz
Copy link
Member

zcbenz commented Apr 29, 2015

@petrbrzek "multi-touch gestures" is a too general topic, can you say more specific about what you want?

@petrbrzek
Copy link
Author

Yes, I want to be able to listen on trackpad gestures events (swipe, pinch to zoom, rotate with two finders, etc.) from JavaScript. As far as I know, trackpad fires only the mousewheel event so you cannot distinguish between scrolling and swiping...

multitouch

@zcbenz
Copy link
Member

zcbenz commented Apr 30, 2015

@petrbrzek For that part of APIs I think you have to wait until Chrome supports some HTML5 standards on touch events, exposing them in JS is huge work and it is not practically to implement them alone in Electron.

@mandric
Copy link

mandric commented Apr 30, 2015

Can you use a JS touch library? http://hammerjs.github.io/

@jacwright
Copy link

@mandric unfortunately no. Those touch events that hammerjs relies on aren't fired on desktop when using the trackpad. Only on mobile.

@jacwright
Copy link

@petrbrzek Chrome already supports touch events on mobile and desktops with touch screens. It just doesn't recognize trackpad gestures.

Also, I believe trying tying into the OS-supported trackpad gestures is a different task than dealing with touch events.

bengotow added a commit to bengotow/electron that referenced this issue Jan 21, 2016
In N1, we want to implement the famous "swipe to archive" action on threads in the user's inbox. Chrome exposes `scroll` and `wheel` events, but these aren't sufficient to implement the interaction because the element needs to "snap" when the user lifts their fingers from the trackpad, not when they / we stop receiving `wheel` / `scroll` events. These events may stop before the user lifts their fingers, or continue after the user has lifted their fingers if they had enough momentum for the gesture to continue.

This exposes BrowserWindow `scroll-touch-down` and `scroll-touch-up`, which fire immeditaely when the user touches two fingers to the trackpad, and again when the user lifts their fingers. Combined with the existing wheel event should allow for "swipe-to-archive" and other similar interactions.

Note: This is only implemented on Mac OS X and the events don't fire unless you're using a trackpad!

Related: electron#1486, electron#2683, nylas/nylas-mail#541
@davewhitley
Copy link

Why was this closed? Has the issue been fixed?

@timfish
Copy link
Contributor

timfish commented Mar 2, 2017

Its non trivial to add and only supported on Mac.

Check out the discussion here over why this hasn't been added to Chrome.

@timfish
Copy link
Contributor

timfish commented Mar 2, 2017

Btw, pinch-zoom events come through in electron as standard JavaScript WheelEvent with ctrlKey set to true

@philfreo
Copy link
Contributor

I see that 3-finger swipe gestures are already supported: https://electronjs.org/docs/api/browser-window#event-swipe-macos

But is there a way to easily detect 2-finger swipe gestures, similar to what Chrome & Safari on mac use for Back/Forward navigation?

@bermanboris
Copy link

Any news on this issue?

@msynk
Copy link

msynk commented Apr 26, 2022

Any updates?

@ngmartins
Copy link

I am experiencing similar problems with 2 finger gestures on electron when running in Linux.
Any update on this?

@maccman
Copy link

maccman commented Sep 25, 2022

Any updates?

@raphaelschaad
Copy link

raphaelschaad commented Oct 25, 2022

For folks looking for support for two-finger swipe navigation: #2683

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests