-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add enablePointerEvents to Canvas init option #5589
Conversation
src/mixins/canvas_events.mixin.js
Outdated
canvasEvtIn: 'mouse:over', | ||
evtIn: 'mouseover', | ||
evtIn: eventTypePrefix + 'over', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those can stay mouse i guess. Renaming this is gonna break application badly. Those are fabricJS events that devs uses, there is no reason to rename them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense -- let's keep the external API as same as possible. I found several other occurrences of the same issue and addressed that in 6c6f4de.
to me this looks like good. Current supported browsers are ie10+, edge, chrome, firefox, safari and a i think they all support pointer events in a way or another. |
Thank you @asturur for your timely feedback! I hope the rest of the tasks before merging wouldn't be tough on your side. Regarding the next step toward pressure-sensitive brushes (#5587), I've looked into the mechanism on how pointer events are passed to free drawing brushes and found They're calling Once the PR is accepted, how about adding the second (or the first for |
i have been buys, getting back to this asap |
@asturur No hurries, but any updates on this? We'd like to move things forward to support pressure-sensitive brushes. |
i jun i ll merge this asap. But i want to talk before you dive into brush changes. brush api can be improved |
@asturur Thanks for your reply, and I'm looking forward to the talk. |
so i m merging this now, tomorrow giving it a run and see if i can extend tests somehow. |
i wonder, should we work to remove touch related events, are those now unnecessary? what could support touch but not pointerevents that make sense to support? |
Thank you for merging the code! I personally love the simplicity of |
Another source for checking unsupported browsers: |
ios safari has so many limitations on canvas too. pointer events can eventually take the place of mouse events when we are sure they work perfectly |
So, in the end, we would only need to support Meanwhile, I think we still need to wait for some more time, and removing support for |
nothing of this is gonna happen soon. |
ohhh stupid Safari. |
There is actually a very good polyfill for PointerEvent: https://www.npmjs.com/package/pepjs. It only needs Has that been tested in this PR? I think the true profit of this PR would be to remove all the old |
i would agree, but we need a solution for ie10 too that adds the msPointer prefix. if then safari polyfill works and can be embedded optionally we can remove touch and mouse all at once. |
IE10? Are you kidding me? 😄 (no offence here) +1 for removing touch and mouse events in the future. |
Well, it has a canvas, supports es5 mostly, not supporting it is a choice not a necessity. So many people for small projects do want to still being able to run mostly everywhere. I'm more like |
That's so true. |
@arcatdmz Has there been any more progress on this? |
Pointer events have been merged and work great. |
Oh that's all I needed. Glad to see they're implemented! What do you mean that 'the event is passed raw to the brush?' I'm not sure I understand where it's being passed to. |
you can extend the pencil brush and change the methods you need to. |
In response to discussions in #5587, this PR adds
enablePointerEvents
option to the Canvas constructor.When the option is enabled by
new Canvas(.., { enablePointerEvents: true })
,PointerEvent
is used instead ofMouseEvent
.The use of
PointerEvent
opens up the potential to retrieve pen pressure information and implement a pressure-sensitive brush.