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

it's possible to draw outside the box, when mouse is not released #249

Closed
laDanz opened this issue May 3, 2017 · 9 comments
Closed

it's possible to draw outside the box, when mouse is not released #249

laDanz opened this issue May 3, 2017 · 9 comments
Labels
Milestone

Comments

@laDanz
Copy link

laDanz commented May 3, 2017

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

What is the current behavior?
On a mobile device (I use ASUS VivoTab Note 8 (Windows 10 Home Version 1511) with Chrome 58.0.3029.96) you can draw outside the box if you begin the signature within the canvas (using your finger), and then leave the canvas(while still holding the finger down) and eventually re-enter the canvas and moveup the finger.
SignaturePad will collect data making the resulting points/svg/... exceed the given bounds.

Please see the screenshot, made with this fiddle: https://jsfiddle.net/t2kbbr4j/
reproduction

What is the expected behavior?
I would expect that the SignaturePad behaves like in the non-mobile version, where you cannot draw outside the box.

Which versions of SignaturePad, and which browser / device are affected by this issue? Did this work in previous versions of SignaturePad?
Tablet: ASUS VivoTab Note 8 (Windows 10 Home Version 1511)
Browser: Chrome 58.0.3029.96
SignaturePad: v2.1.1
Did this work in previous versions of SignaturePad? I don't know.

@szimek szimek added the bug label May 3, 2017
@szimek szimek added this to the 2.2 milestone May 3, 2017
@szimek
Copy link
Owner

szimek commented May 3, 2017

Uh, I'll try it out on Android tablet (I don't have a Windows one) and see if I can replicate it. If it really does return points outside of the canvas, I guess I'll have to check if coordinates are inside a canvas (i.e. are not negative and not higher than canvas dimensions)...

The previous versions of signature-pad (prior to 2.0.0) didn't return point coordinates, so it could be broken before, but wasn't visible.

@szimek szimek modified the milestones: 2.2, 3.0 May 27, 2017
@arnoldmanzano
Copy link

Confirmed seeing this issue. Observed in Android 6/7 and iOS safari.
Able to re-create it by using Chrome dev-tools Device toolbar emulating a mobile-touchscreen device.

@szimek
Copy link
Owner

szimek commented Aug 16, 2017

I don't have that much time work to on this library, so it would be great if someone could create a PR with a fix for this issue.

Maybe it would be enough to simply check if point coordinates are outside of the canvas (i.e. smaller than 0 or greater than height/width of the canvas), or maybe it would result in some strange curves being drawn...

@arnoldmanzano
Copy link

Hi szimek, created a PR for this #324. Your suggestion seems to work well.

@UziTech
Copy link
Collaborator

UziTech commented Nov 15, 2021

closing as stale

@UziTech UziTech closed this as completed Nov 15, 2021
@SamuelWillis
Copy link

Bumping this issue as I am still able to replicate this on touch screen devices. Non touchscreen devices seem to blend the line within the canvas fairly well, however.

Here's a little demo video:

Screen.Recording.2022-08-09.at.2.54.51.PM.mov

@MarouaneSH
Copy link

@SamuelWillis did you manage to fix this issue ?

@SamuelWillis
Copy link

@MarouaneSH unfortunately not.

@UziTech
Copy link
Collaborator

UziTech commented Nov 21, 2023

#703 is an attempt to fix this but I haven't had time to get it completely working and write tests. The issue is that it doesn't work in all browsers because they have different definitions of enter and leave for the events.

Unfortunately the solution will probably have to be browser specific.

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

No branches or pull requests

6 participants