-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
Selecting does not work after calling .stop() and .start() #209
Comments
Hi @ThibaultJanBeyer, have you had a chance to read this one yet? I was hoping for your input before putting forward a PR since I don't understand the internals of DragSelect as well as you. For what it's worth, I found a workaround. By calling the internal Interaction._reset(event) method immediately before stopping DragSelect, I can effectively set the isInteracting flag to false. However it doesn't feel like a good long-term solution. Thank you for your time! |
Sorry I did not have the time yet, I'll try to make some time this or next week. In the long run I would love to have a very proper way to integrate 3rd party tools but that's a lot of work maybe we can find a quick fix like what you proposed. Thanks a lot so far for raising this, the workaround and your patience!! |
Describe the bug
Hi @ThibaultJanBeyer, thank you for maintaining this great library! I recently created a prototype with v3 following the "Custom Drag and Drop" guided example. My use case is to implement a web file system with select/drag/drop functionality, so I need to handle drags outside of DragSelect. The issue is that once I resume DragSelect by calling .start(), I can no longer click/drag to select new items. I created a codepen with the following minor changes:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
After dragging and releasing an item, I should be able to drag/select new items
Code Example
https://codepen.io/dbougan/pen/abProMo?editors=1111
Desktop (please complete the following information):
Additional context
I spent a little time studying the code and believe the issue is in the Interaction module and the
isInteracting
flag. It seems that when the Interaction.stop() method is triggered by DragSelect.stop(), it should explicitly setisInteracting = false
. Because when DragSelect.start() is subsequently called and a new selection drag is attempted, the Interaction._start() method can never get past this code:if (!this._canInteract(event)) return;
since isInteracting is still true from before DragSelect.stop() was called.I tested the theory by adding line 173 in the screenshot below, which seems to have resolved the issue for me. However this is probably a naive approach, so I am hoping you can provide feedback. I'd be happy to submit a PR once we get to the root cause.
Thank you for your time!
The text was updated successfully, but these errors were encountered: