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

preserve original event when eventTarget is used #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nikrowell
Copy link

Using document.body (or anything other than the default canvas) for eventTarget will hijack the original event. This change checks if the eventTarget is the canvas element before calling preventDefault(). I tried adding a test but getting Cannot simulate touch events - use examples to validate functinality in Chrome.

Easy to verify in the drawing example: with eventTarget: document.body, moves movements underneath the info panel continue painting and clicking "View on Github" follows the link.

@akakoori
Copy link

akakoori commented Jun 9, 2017

Good job, nikrowell! This's exactly what I'm looking for. preventDefault() makes using document.body for eventTarget actually meaningless.

There are cases where we want to preventDefault() or not judging by the eventType or the srcElement, better let developers to handle that rather than simply prevent all.

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

Successfully merging this pull request may close these issues.

2 participants