Skip to content
New issue

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

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

Already on GitHub? # to your account

Issue with Apple Pencil #315

Open
andrewkendall opened this issue Apr 8, 2019 · 3 comments
Open

Issue with Apple Pencil #315

andrewkendall opened this issue Apr 8, 2019 · 3 comments

Comments

@andrewkendall
Copy link

There is currently an issue when using an Apple Pencil. Using the Apple Pencil always triggers a touchmove event, meaning the simulated click doesn't work as intended.

// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved) {

  // Simulate the click event
  simulateMouseEvent(event, 'click');
}

A quick fix is to update the code to:

// If the touch interaction did not move, it should trigger a click
if (!this._touchMoved || event.originalEvent.changedTouches[0].touchType === 'stylus') {

  // Simulate the click event
  simulateMouseEvent(event, 'click');
}

Hopefully, that will help someone who is struggling with click events with the Apple Pencil. If anyone has a neater update to the code I'd love to know.

@andrewkendall
Copy link
Author

andrewkendall commented Apr 8, 2019

@RWAP you're doing great work folding in fixes, you might want to take a look at this one. It works better with your updated code as you are also watching for the amount of movement before triggering a click.

RWAP added a commit to RWAP/jquery-ui-touch-punch that referenced this issue Jun 3, 2019
This fixes the issue: furf#315 where the Apple Pencil triggers a touchmove event and you may struggle to trigger a click with the pencil
@RWAP
Copy link

RWAP commented Jun 3, 2019

@RWAP you're doing great work folding in fixes, you might want to take a look at this one. It works better with your updated code as you are also watching for the amount of movement before triggering a click.

Thanks - I have suggested a change - RWAP#3
Can you please verify my change - as I do not have an Apple device (let alone a Pencil!)

@andrewkendall
Copy link
Author

@RWAP I've just tested on iPad mini 5 and 12.9-inch iPad Pro. That works perfectly.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants