The backlogDrag state manages drag-and-drop operations for recursive Bean items in the backlog view. It uses a single source of truth to track which bean is being dragged and where the drop target is located.
Card Hover Zones
When hovering over a card, the system determines the dropMode based on the vertical position relative to the card's height:
- Top 25%: Sets
dropMode to 'reorder' to place the item above the hovered bean. - Middle 50%: Sets
dropMode to 'reparent' to make the hovered bean the new parent of the dragged item. - Bottom 25%: Sets
dropMode to 'reorder' to place the item below the hovered bean.
Drop Modes
reorder: Moves a bean to a specific index within a parent group. Controlled by dropTargetParent and dropIndex.reparent: Changes the parent of a bean to a different bean. Controlled by reparentTargetId.
Visual Indicators
The state provides helper methods to determine when to show UI feedback:
showIndicator(...): Returns true if a reorder line should appear at a specific index.showEndIndicator(...): Returns true if a reorder line should appear at the end of a list.isReparentTarget(beanId): Returns true if the hovered bean is currently targeted for reparenting.
// Example of checking for visual indicators in a Svelte component
{#if backlogDrag.showIndicator(bean.parentId, index, bean.id, bean.status)}
<div class="drop-indicator"></div>
{/if}