4

I am trying to support a MacBook's trackpad with similar controls to my touch controls for mobile, using javascript. It maps to the mouse events however, and doesn't fire the touch events.

When I right click, I get a mousedown event with event.button == 2. When I perform a two-finger tap on the trackpad, I get the same event.

Is there any way to tell these two apart, so I can customize their behavior?

eadsjr
  • 681
  • 5
  • 20
  • I believe your question was already answered here : [touchpad vs mouse](https://stackoverflow.com/questions/10744645/detect-touchpad-vs-mouse-in-javascript) – Alexandre FERRERA Oct 13 '19 at 19:38
  • @ Alexandre FERRERA: It was NOT answered there. The solution to use scroll events is valuable for differentiating during a scroll event, but does not assist in determining whether a trackpad tap or mouse click was performed. – eadsjr Oct 13 '19 at 19:42
  • A similar, and similarly unanswered, question: https://stackoverflow.com/questions/27293992/track-pad-tap-event-in-javascript-jquery – eadsjr Oct 13 '19 at 19:43
  • To clarify, my code already uses that technique to determine which is used while scrolling. You can use either and can use them interchangeably, in the course of a session using the app, with each behaving in the expect custom way during the scroll. This doesn't tell me however which they are using unless they scroll. The code in that thread does not account for users who switch back and forth. – eadsjr Oct 13 '19 at 19:56

0 Answers0