Node Connectors - IRobot1/three-flow-ts GitHub Wiki
NodeConnectors
manages connectors for nodes in a flow diagram. Its an internal class used by FlowConnector
and not meant to be used or extended directly.
Constructors
- NodeConnectors(connectors: FlowConnectors, node: FlowNode, parameters: Array)
- Description: Initializes a new instance of the
NodeConnectors
class, attaching connectors to a given node based on specified parameters. - Parameters:
connectors
(FlowConnectors): The FlowConnectors instance managing the node's connectors.node
(FlowNode): The flow node to which connectors are attached.parameters
(Array): An array of parameters defining the connectors.
- Example:
const flowConnectors = new FlowConnectors(flowDiagram); const nodeConnectors = flowConnectors.hasNode('node1');
- Description: Initializes a new instance of the
Properties
- spacing
- Type:
number
- Description: The space between connectors on the node.
- Type:
Public Methods
-
hasConnector(id: string): ConnectorMesh | undefined
- Description: Checks if a connector with a given ID exists on the node and returns it if found.
- Parameters:
id
(string): The ID of the connector to find.
- Returns: ConnectorMesh | undefined
- Usage:
const connector = nodeConnectors.hasConnector('connectorId');
-
addConnector(item: FlowConnectorParameters): ConnectorMesh
- Description: Adds a connector to the node based on the provided parameters.
- Parameters:
item
(FlowConnectorParameters): Parameters defining the connector to be added.
- Returns: ConnectorMesh
- Usage:
const newConnector = nodeConnectors.addConnector({ id: 'connector2', anchor: 'right' });
-
removeConnector(connector: FlowConnectorParameters)
- Description: Removes a specified connector from the node.
- Parameters:
connector
(FlowConnectorParameters): Parameters of the connector to be removed.
- Returns:
void
- Usage:
nodeConnectors.removeConnector({ id: 'connector2' });