TemporaryConnection class

Represents a temporary connection during a drag-and-drop operation.

A TemporaryConnection is created when a user starts dragging from a port and is updated as the mouse/pointer moves. It becomes a permanent connection when dropped on a valid target port, or is discarded if the drag is cancelled.

Immutable Properties (Set at Start)

Observable Properties (Change During Drag)

  • currentPoint: Current pointer position
  • targetNodeId: ID of the target node (null until hovering over valid target)
  • targetPortId: ID of the target port (null until hovering over valid target)

Usage Example

// Create when drag starts
final tempConnection = TemporaryConnection(
  startPoint: portPosition,
  sourceNodeId: 'node-1',
  sourcePortId: 'port-out',
  initialCurrentPoint: portPosition,
);

// Update as pointer moves
tempConnection.currentPoint = newPointerPosition;

// Set target when hovering over a valid port
tempConnection.targetNodeId = 'node-2';
tempConnection.targetPortId = 'port-in';

See also:

Constructors

TemporaryConnection({required Offset startPoint, required String sourceNodeId, required String sourcePortId, required Offset initialCurrentPoint, String? targetNodeId, String? targetPortId})
Creates a temporary connection for drag-and-drop operations.

Properties

currentPoint Offset
The current pointer position.
getter/setter pair
currentPointObservable → Observable<Offset>
Gets the MobX observable for the current point.
no setter
hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sourceNodeId String
ID of the node containing the source port.
final
sourcePortId String
ID of the source port where the connection originates.
final
startPoint Offset
The position where the connection starts (source port position).
final
targetNodeId String?
ID of the target node.
getter/setter pair
targetNodeIdObservable → Observable<String?>
Gets the MobX observable for the target node ID.
no setter
targetPortId String?
ID of the target port.
getter/setter pair
targetPortIdObservable → Observable<String?>
Gets the MobX observable for the target port ID.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override