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

Add support for pointerEvents #128

Closed
wants to merge 1 commit into from
Closed

Add support for pointerEvents #128

wants to merge 1 commit into from

Conversation

HollowMan6
Copy link
Contributor

Hi, thanks for this great library. I'm now preparing to use DragSelect for implementing Google Blockly's multiselection project. However, DragSelect can't work on Blockly as of now, Google Blockly uses the pointerEvents:

https://github.com/google/blockly/blob/24a808d54eef1711801ff3b7e6082409a8a78666/core/browser_events.js#L95-L100
https://github.com/google/blockly/blob/master/core/touch.js#L58-L69

So this PR makes DragSelect also listen to the pointerEvents so that it can work for the Blockly. It would be great if this PR can get merged and a new release can be drafted for this. Thank you!

@HollowMan6 HollowMan6 marked this pull request as draft June 13, 2022 15:29
@HollowMan6
Copy link
Contributor Author

HollowMan6 commented Jun 14, 2022

https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events

I have created a new option to enable replacing mouse events with pointer events, as they are replaceable, and currently there's a BUG in handling the touch event, and which also applies to the pointer event:

GIF 14-06-2022 16-18-57

As you can see, for the latest release version (not because of my PR), the object doesn't always follow the touch point move when dragging, which is different from the mouse events.

For the drawing a rectangle to drag and select behavior, it behave as expected. Since my project only uses that feature, and I have no bandwidth to fix the drag and move (I have no pen/stylus to test), then making it an option which is disabled by default is the best solution for me and other users.

Copy link
Owner

@ThibaultJanBeyer ThibaultJanBeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution, it looks good and you're right in the long run we should fix whatever is causing the weird behaviour on touch.

I was wondering, shouldn't the pointer event then replace both, the mouse events and the touch events?

Thanks!

src/modules/Interaction.js Show resolved Hide resolved
Signed-off-by: Hollow Man <hollowman@opensuse.org>
@ThibaultJanBeyer
Copy link
Owner

I'll try to merge it as soon as I've time, thanks for your contribution! 💪

@ThibaultJanBeyer
Copy link
Owner

sorry for the delay, life happened. Unfortunately had to create a new branch as I could not push to yours. Continuing this here: #143

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