ConnectionState
The ConnectionState type bundles all information about an ongoing connection. It is returned by the useConnection hook.
type NoConnection = {
inProgress: false;
isValid: null;
from: null;
fromHandle: null;
fromPosition: null;
fromNode: null;
to: null;
toHandle: null;
toPosition: null;
toNode: null;
};
type ConnectionInProgress = {
inProgress: true;
isValid: boolean | null;
from: XYPosition;
fromHandle: Handle;
fromPosition: Position;
fromNode: NodeBase;
to: XYPosition;
toHandle: Handle | null;
toPosition: Position;
toNode: NodeBase | null;
};
type ConnectionState = ConnectionInProgress | NoConnection;Fields
The ConnectionState type bundles all information about an ongoing connection.
It is returned by the useConnection hook.
inProgress: booleanIndicates whether a connection is currently in progress.isValid: boolean | nullIf an ongoing connection is above a handle or inside the connection radius, this will betrueorfalse, otherwisenull.from: XYPosition | nullReturns the xy start position ornullif no connection is in progress.fromHandle: Handle | nullReturns the start handle ornullif no connection is in progress.fromPosition: Position | nullReturns the side (called position) of the start handle ornullif no connection is in progress.fromNode: NodeType | nullReturns the start node ornullif no connection is in progress.to: XYPosition | nullReturns the xy end position ornullif no connection is in progress.toHandle: Handle | nullReturns the end handle ornullif no connection is in progress.toPosition: Position | nullReturns the side (called position) of the end handle ornullif no connection is in progress.toNode: NodeType | nullReturns the end node ornullif no connection is in progress.pointer: XYPosition | nullReturns the pointer position ornullif no connection is in progress.