InteractionState class
Contains all interaction-related state for the node flow editor.
This class manages the state for various user interactions including:
- Node dragging
- Connection creation
- Multi-node selection
- Mouse cursor state
- Pan/zoom control
All state is managed using MobX observables for reactive updates. The class provides both low-level observables and high-level convenience getters for accessing state.
Example usage:
final state = InteractionState();
// Check if user is dragging a node
if (state.currentDraggedNodeId != null) {
// Handle drag
}
// Start a connection
state.update(
temporaryConnection: TemporaryConnection(
sourceNodeId: 'node-1',
sourcePortId: 'port-1',
),
);
See also:
- TemporaryConnection, which represents an in-progress connection
Constructors
Properties
- connectionStartNodeId → String?
-
Gets the starting node ID of the temporary connection.
no setter
- connectionStartPortId → String?
-
Gets the starting port ID of the temporary connection.
no setter
- currentCursorOverride → MouseCursor?
-
Gets the current cursor override, if any.
no setter
- currentDraggedNodeId → String?
-
Gets the ID of the currently dragged node.
no setter
- currentSelectionRect → GraphRect?
-
Gets the current selection rectangle in graph coordinates.
no setter
-
cursorOverride
→ Observable<
MouseCursor?> -
Observable cursor override for exclusive operations like resizing.
final
-
draggedNodeId
→ Observable<
String?> -
Observable ID of the node currently being dragged.
final
- hasCursorOverride → bool
-
Checks if there is an active cursor override.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasStartedSelection → bool
-
Gets whether the user has indicated selection intent.
no setter
-
hoveringConnection
→ Observable<
bool> -
Observable flag for whether the cursor is hovering over a connection.
final
- isCreatingConnection → bool
-
Checks if a connection is currently being created.
no setter
- isDrawingSelection → bool
-
Checks if a selection rectangle is being drawn.
no setter
- isHoveringConnection → bool
-
Gets whether the cursor is hovering over a connection.
no setter
- isPanEnabled → bool
-
Gets whether panning is enabled.
no setter
- isViewportDragging → bool
-
Gets whether the viewport is currently being interacted with (panning/zooming).
no setter
-
isViewportInteracting
→ Observable<
bool> -
Observable flag for whether the viewport is currently being interacted with.
final
-
lastPointerPosition
→ Observable<
ScreenPosition?> -
Observable position of the last pointer event in screen/widget-local coordinates.
final
-
panEnabled
→ Observable<
bool> -
Observable flag for whether panning is enabled.
final
- pointerPosition → ScreenPosition?
-
Gets the current pointer position in screen/widget-local coordinates.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
selectionRect
→ Observable<
GraphRect?> -
Observable selection rectangle bounds in graph coordinates.
final
-
selectionStart
→ Observable<
GraphPosition?> -
Observable starting point of a selection rectangle in graph coordinates.
final
-
selectionStarted
→ Observable<
bool> -
Observable flag for whether the user has indicated selection intent.
final
- selectionStartPoint → GraphPosition?
-
Gets the starting point of the selection rectangle in graph coordinates.
no setter
-
temporaryConnection
→ Observable<
TemporaryConnection?> -
Observable temporary connection being created.
final
Methods
-
cancelConnection(
) → void - Cancels the current connection creation.
-
finishSelection(
) → void - Finishes the current selection operation.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resetState(
) → void - Resets all interaction state to default values.
-
setCursorOverride(
MouseCursor? cursor) → void - Sets a global cursor override for exclusive operations.
-
setDraggedNode(
String? nodeId) → void - Sets the currently dragged node.
-
setHoveringConnection(
bool hovering) → void - Sets the connection hover state.
-
setPointerPosition(
ScreenPosition? position) → void - Sets the current pointer position in screen/widget-local coordinates.
-
setSelectionStarted(
bool started) → void - Sets the selection started state.
-
setViewportInteracting(
bool interacting) → void - Sets the viewport interaction state.
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
{bool? panEnabled, TemporaryConnection? temporaryConnection}) → void - Updates multiple state properties atomically.
-
updateSelection(
{GraphPosition? startPoint, GraphRect? rectangle, List< String> ? intersectingNodes, bool? toggle, dynamic selectNodes(List<String> , {bool toggle})?}) → void - Updates selection rectangle state and handles node selection.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited