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

Drawing with two fingers jumps between points. Can't disable multitouch #787

Open
piotrpoliwoda opened this issue Aug 29, 2024 · 5 comments

Comments

@piotrpoliwoda
Copy link

piotrpoliwoda commented Aug 29, 2024

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
When drawing with two fingers the touch points jump around both fingers.

Replication steps:

  1. Go to the sample site: https://szimek.github.io/signature_pad/
  2. Use two fingers to draw a line.

Result:
The signature creates a connecting line between two fingers.

See result screenshot:
image

Do this:
image

What is the expected behavior?
The expected behaviour is that multitouch should be disabled. Looking through the code, it is theoretically trying to prevent a double touch but it doesn't really work on a mobile device. The lines are created and can make a big black square.

Which versions of SignaturePad, and which browser / device are affected by this issue? Did this work in previous versions of SignaturePad?

Version: 5.0.3
Browser: All of them, iOS safari and Chrome as well as Android Chrome.

Some debugging information:

  • On iOS in Safari, the mobile web browser event is being caught by the mousePointer click even though the pointerType: "touch"
  • When touching the screen, the canvas pointerDown event does not get any of the event.touches nor event.targetTouches they are undefined
    image
  • There is no easy way to catch if the user is already touching the screen as the drawingStroke turns to false when holding one finger down and pressing down with another finger.
    image
  • See full event data.
    image
@UziTech
Copy link
Collaborator

UziTech commented Aug 29, 2024

If you would like to create a PR that would be awesome 😁👍

@wokayme
Copy link

wokayme commented Aug 30, 2024

@UziTech I think this should address the problem:
#788
can I ask you for CR and help with testing :) ?

@UziTech
Copy link
Collaborator

UziTech commented Aug 30, 2024

For testing you should need to update the tests with the new property and create a test that has both isPrimary true and false touches.

it('allows user to paint on the pad', () => {

@wokayme
Copy link

wokayme commented Aug 31, 2024

What do you mean by false touches? you mean pointerDown with isPrimary false?
Or mixed events? (points and touch in the same moment)

Also where I should add the tests?
Inside user interactions describe ?

@UziTech
Copy link
Collaborator

UziTech commented Aug 31, 2024

Sorry I meant "IsPrimary (true and false) touches". Like set isPrimary: true on some touches and isPrimary: false on some touches in the same test.

Ya user interactions describe sounds good

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

3 participants