Skip to content

Support drag behavior for all selected components, not just blocks #192

@draedful

Description

@draedful

Currently, the drag behavior in BlockController only affects selected blocks. When a user drags a block, it correctly drags all other selected blocks together, but it ignores other types of selected components (custom Layer components, groups, etc.) that might be selected through the SelectionManager.

Current Implementation

In BlockController.ts (lines 47-49):

const draggingElements = block.context.graph.rootStore.blocksList.$selectedBlocks.value.map((block) =>
block.getViewComponent()
);

Expected Behavior

All selected components should participate in drag operations if they support dragging. The library should:

  1. Distribute drag events to all selected components - When dragging, all selected components should receive DRAG_START, DRAG_UPDATE, and DRAG_END events
  2. Support opt-in drag behavior - Components should have a draggable: boolean property to opt into drag support
  3. Provide default drag implementation in GraphComponent - Basic drag logic (with snapping, autopanning, capturing, cursor support) should be available as default behavior in GraphComponent

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions