The 2D drag/drop engine that powers the canvas, sidebar layer reordering, and toolbox-to-canvas drops.
The 2D drag/drop engine that powers the canvas, sidebar layer reordering, and toolbox-to-canvas drops.
index.tsx shell + useCanvasItemDrag / useCanvasItemResize hooks)getSpatialMainAxisForComponentName, getSuppressCrossAxisAlignForComponentName (component-specific overrides)findPosition2D — given a pointer position over a target container, returns the drop slot (before/after a child, into a child, into the empty container). 2D-aware — uses both axes to disambiguate row vs column targets.SPATIAL_MAIN_AXIS_BY_NAME.From .claude/rules/drag-listeners.md:
pointermove/pointerup/pointercancel/blur to window on pointerdown.onPointer* props for the move/up phase.setPointerCapture alone — outside the captured target, events still leak.shouldPromoteToParent in the drop logic must inspect the parent flex direction, not just the current container's. Without that check, flex-row sections trap drops — the cursor crosses an inner column boundary and the engine wrongly flags "drop into this column" instead of "drop after the section". See feedback_drop_promote_guard and the project memory for context.