atlassian / pragmatic-drag-and-drop

Fast drag and drop for any experience on any tech stack
https://atlassian.design/components/pragmatic-drag-and-drop
Other
9.82k stars 223 forks source link

Feature: Make tree hitbox zones configurable #49

Open buzzie-bee opened 6 months ago

buzzie-bee commented 6 months ago

I've implemented a tree drag and drop and for business logic reasons certain items cannot be dropped onto other items.

I have implemented a 'make-child' block, but when dragging items over these blocked items the indicators are very janky, they flash in and out as the mouse moves. This is because the instruction is being set to 'instruction blocked' when the mouse is near the center of the items.

It would be nice for new users to be able to configure the zones via arguments, instead of having to clone the hitbox code and customise it yourself (which is straightforward enough once you're used to pragmatic-drag-and-drop).

I'm thinking it would be great to pass in some enabled/disabled flags along with percentage values for the different zones. This would allow users to remove zones for instructions which are blocked completely, i.e. only allow make child, only allow reorder-above/below, only have blocked, etc.

alexreardon commented 3 months ago

As a stop gap, you are totally free to copy our tree hitbox (and tree indicator) packages and adjust them to your needs. It's one of the nice things about hitboxes / indicators being optional additions