desandro / draggabilly

:point_down: Make that shiz draggable
https://draggabilly.desandro.com
MIT License
3.86k stars 387 forks source link

How can I create a container with "stamps", the ability to prevent dragging into an area within a container #100

Closed LordZardeck closed 8 years ago

LordZardeck commented 9 years ago

I am making an app where I have "windows" floating on the screen. Then i have "cards" that are dragged around the entire screen. I don't want the "cards" able to be dragged "behind" the "windows". In other MetaFizzy project such as Masonry, you can "stamp" out an area that is ignored for layouts. Is this possible with this library? If not, is there a way to "hook" into this library to add that functionality myself? If so, where would I begin?

desandro commented 9 years ago

You might want to look into how Packery handles dragging. Setting no-drag areas can be complicated. It's actually an unresolved issue with Packery metafizzy/packery#203

LordZardeck commented 9 years ago

@desandro Would I have to fork draggabilly in order to make this work? Or is there some events/plugin system that I can use in order to not modify core code

desandro commented 9 years ago

You can use Draggabilly's events API. You don't need to fork it and modify its source. Packery uses standard Draggabilly events.

LordZardeck commented 9 years ago

@desandro Looking at the source of dragMove I see that an event is dispatched, but I don't see a way to override/prevent a drag from the event.