-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Ability to drag selected group #24
Comments
Hmm, since there are already callbacks for continuous clicks, I’m not sure what you mean. Would you be so kind to elaborate your issue further? Thank you |
Hi, thanks for the response, sorry for not being clear: As a user, I want to be able to select multiple blocks, so that I can drag them as a group. I'm currently working on a form builder where I'm looking to add the ability to (drag) select multiple form elements and then drag the selected group of elements as a group elements as a group. The idea I have is kind of like this - the concept, not the implementation: |
Hey @elmarti, thanks for clarifying. Yes. That is indeed a feature I intended to add. However, it is a lot of work and also a lot of code to add. Ideally functionality would be separated in separete plugins. I have a plugin for drag and drop functionality dragNdrop. dragNdrop unfortunately is only capable to handle a single element at a time for now. In my opinion, this would be solved the best by implementing a functionality inside dragNdrop to be able to handle multiple elements first. Then you could use DragSelect to create the selection, which would pass the selected elements to dragNdrop which would make it possible to drag and drop the group of items. As I’m working on this alone it will take a while. If you feel confident enough, I would love your help to achieve this. Thanks a lot for sharing. Now I know that there is a valid usecase for this functionality. |
I created a corresponding ticket inside dragNdrop |
Great, I'll look into it and see if I can be of any help 😄 |
Yes, that’s quite difficult because how can you know if someone wants to move the files or to set a new selection? I can think of some hacky way like on a selection callback setting a break for new selection or stopping the functionality. Something like this:
In your code, you would have to somehow detect that the user wants to Maybe the As I see this use-case more and more often, I really want to build that Drag after selection functionality. I have a clear idea on how to write such a plugin on top of this one. However, it’s not trivial and I’m in lack of time currently… So bear with me on that one please :/ |
In this instance I would expect a new selection to not be set when the event target is one of the |
what about selection on mouseup and mousemove event instead of mousedown? mousedown clears the selection directly which makes impossible to get current selection. I want to make a timeout on mousedown event
and clear it on mousemove event
|
Ok guys, based on your request I’ve added
Which solves your specific use-case. I know that it’s not ideal, but it will unblock you for now. |
Can we remove Currently I’m dragging selected items with alt+click and selecting with only left click. But I think It is better to make it activate dragging by holding left mouse in certain time |
I'm currently also in need of this feature. Will see if I can get it working for my app. If there's any way I can contribute to this project I'd be glad to do so as well. However if anyone has already begun work on this feature, I'm wondering if you could share any insights or updates you may have so we don't retread the same ground :) |
Yes I'm working on it. It's not an easy one tho' it's a big task and between work and home there is not much time, I fear that you'll have to be patient :/ |
As the original creator of this issue, I thought i'd share 2 solutions I've come up with in the past 2 years. Although this is a great library, I ended up making something custom for the very specific use cases. Overlaying
Drawbacks
Translating each selected element
Drawbacks
I'm happy to help with any of these features if you want to unload some work onto me. When I opened this issue I was new to DnD, but now i've been around the block with it. |
I am also trying to move SVG elements in groups. How do you place multiple SVG items within a
Nothing happens to the elements. |
Man how fast time flies :O @elmarti thanks a lot for your input. In fact, it's exactly the two solutions I also thought of! 👍 Yes, the overlay is also what we used in our company in combination with DragSelect. I think it's the easiest solution. But from the usability, I would prefer the second solution! Because the intention of DragSelect is to mimic the native os drag solution in your OS and the behavior is the following (try it on some files on your desktop i.e.):
|
I don't understand how to check for elements in the selection. After I figure that out, how can I wrap them in an SVG
I am using the plain-draggable library. I can switch to your library but I want to keep constraints for objects that were worked into his library like this: This next section sets constraints so SVGs cannot touch. The problem with this library is that I can only use
Thank you! |
Just FYI, you probably by now, have your own workaround but I started to work on this. There is still a lot to do, so since this is my free-time it'll still take a while, but here is a sneak-peek for you to enjoy :D I can't say any specific date but I aim to release it as new functionality in version 2 (since it's a breaking change as it'll be enabled by default) and I think I'll make it a native integration/functionality of the tool itself Cheers and stay tuned 🍻 €dit: would be nice to have some beta testing here. I pushed the changes to the branch _€dit: intial add in commit 8f99e7a41cb18f9e90b0e59bee71d93d396d67c7 |
Quick Update Next up:
(see todos, for v2 only tests are missing) |
Is your feature request related to a problem?
When drag selecting multiple elements in a form builder, I would then like to be able to drag them as a group
Describe the solution you'd like
I would like a callback for holding a continuous click on an individual element which is selected alongside numerous others
The text was updated successfully, but these errors were encountered: