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

Multiple objects dragged if overlapping #9

Closed
peterssonanton opened this issue Jun 26, 2019 · 3 comments
Closed

Multiple objects dragged if overlapping #9

peterssonanton opened this issue Jun 26, 2019 · 3 comments

Comments

@peterssonanton
Copy link

Maybe I'm missing something, but I can't find a way to only drag the object on top if there are multiple close to or overlapping each other. When two elements are stacked on top of eachother they both get selected when dragging. JSfiddle here: https://jsfiddle.net/L4q65vu2/
Thanks :)

@davideperozzi
Copy link
Owner

Hey, there is not built-in functionality for this, since the handler is attached to the container which contains both elements. There is no checking in which layer the element is located in. It only checks the position. But you can implement this "z-index check" by yourself. Here's an example, which I've created quickly. Please do not use this in production. I only want to give you an idea on how this could be done:

https://jsfiddle.net/davideperozzi/9h6203ms/

@peterssonanton
Copy link
Author

Thanks for the help! I think this solution will be good enough for my case, do you want me to close the issue?

@davideperozzi
Copy link
Owner

You're welcome! Yeah, I'm going to close it. Feel free to open a new one if you need help! :)

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