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

Preventing elements being dragged on top of other elements #119

Open
antony opened this issue Feb 3, 2023 · 1 comment
Open

Preventing elements being dragged on top of other elements #119

antony opened this issue Feb 3, 2023 · 1 comment

Comments

@antony
Copy link

antony commented Feb 3, 2023

I guess this ties in a bit with a feature you've named obstacles. As commonly seen in website-builders, or todo-lists, it'd be really useful to have a feature that prevents elements being dragged on top of other elements.

I guess the slight divergence from the obstacles feature would be the behaviour here. I'd like to be able to choose to either prevent dropping of an object by changing the cursor/otherwise indicating that it isn't possible, but more importantly - and this works better if you've got a grid enabled, and if you're restricting movement to a single direction, but I'd like to be able to tell other elements to move out of the way, allowing me space to drop the element. In the case that I dropped it there, the elements would move completely out of the way to accommodate the dropped one.

It's useful when you have a set of blocks and you just want them to be re-arrange-able.

Hopefully this is clear enough but if not, I can find an example!

@PuruVJ
Copy link
Owner

PuruVJ commented Mar 20, 2023

Hey Antony 👋

Not sure if this is fully in the scope of the library. I could add an option beforeCollide which fires when it is about to hit the obstacle area, and you could perform your logic in that.

How does that sound?

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

No branches or pull requests

2 participants