DragSelect icon indicating copy to clipboard operation
DragSelect copied to clipboard

Add support for pointerEvents

Open HollowMan6 opened this issue 2 years ago • 2 comments

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 avatar Jun 13 '22 14:06 HollowMan6

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.

HollowMan6 avatar Jun 14 '22 08:06 HollowMan6

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

ThibaultJanBeyer avatar Jul 27 '22 14:07 ThibaultJanBeyer

sorry for the delay, life happened. Unfortunately had to create a new branch as I could not push to yours. Continuing this here: https://github.com/ThibaultJanBeyer/DragSelect/pull/143

ThibaultJanBeyer avatar Nov 02 '22 18:11 ThibaultJanBeyer