Skip to content

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