Skip to content

Commit 8fb9f35

Browse files
committed
feat: add inspect mode to NodeFlowBehavior and enhance node drag logic with behavior checks
1 parent 1dfc392 commit 8fb9f35

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

packages/vyuh_node_flow/lib/src/editor/node_flow_behavior.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ enum NodeFlowBehavior {
5050
canZoom: true,
5151
),
5252

53+
/// Inspect mode - view and select, but no modifications or rearrangement.
54+
///
55+
/// Use this for runtime inspection where you want to select nodes to view
56+
/// their state but prevent any layout changes. Ideal for execution/run modes
57+
/// where the graph layout should remain stable.
58+
inspect(
59+
canCreate: false,
60+
canUpdate: false,
61+
canDelete: false,
62+
canDrag: false,
63+
canSelect: true,
64+
canPan: true,
65+
canZoom: true,
66+
),
67+
5368
/// Presentation mode - display only, no interaction.
5469
///
5570
/// Use this for embedded displays, thumbnails, or presentation contexts

packages/vyuh_node_flow/lib/src/nodes/node_container.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class NodeContainer<T> extends StatelessWidget {
151151
createSession: () =>
152152
controller.createSession(DragSessionType.nodeDrag),
153153
// Drag lifecycle - unified for all node types
154-
isDraggable: !node.locked,
154+
// Check both node lock state AND behavior mode
155+
isDraggable: !node.locked && controller.behavior.canDrag,
155156
onDragStart: (_) => controller.startNodeDrag(node.id),
156157
onDragUpdate: (details) =>
157158
controller.moveNodeDrag(details.delta),

0 commit comments

Comments
 (0)