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

Provide a reset/return mechanism on drag-end #227

Open
Cyara-Andrew-Watson opened this issue Jul 1, 2024 · 1 comment
Open

Provide a reset/return mechanism on drag-end #227

Cyara-Andrew-Watson opened this issue Jul 1, 2024 · 1 comment

Comments

@Cyara-Andrew-Watson
Copy link

With drag-select, the selection and drag functionality is really simple.

But, as far as I can see, when the user releases an item, there is no built-in way to return the dropped item(s) to where they came from?
It would be great if, on drop, we could return some data which would indicate to drag-select that the item can remain where it is, or must be returned back to where it came from.
As we are using the translate method of drag-positioning, at the moment, I just remove that style from the items being dragged - so that they are positioned where I want, not where drag-select offset them to. (doing drag-to-order, and the order of the elements change to set the final position, and any translate style that carries over would mess that up).

If there is a way to do this currently, perhaps update the documentation, or point me at the relevant method to achieve this?

@ThibaultJanBeyer
Copy link
Owner

Hi @Cyara-Andrew-Watson, thanks for the feature request.

As to answer on how I'd do it, probably you could use DS:start to store the elements starting position and then on DS:end put them back to the stored location if they don't fullfil the criteria you deem necessary to be moved? As of now DragSelect does not store original positions of elements on start.

In regards to the feature request could you please elaborate what you'd like to achieve? Like when should the elements be put back at the original position on start and why?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants