endpointsOf method
Scene-space endpoints, or null if either end no longer exists.
Implementation
ConnectionEndpoints? endpointsOf(NodeConnection connection) {
final fromNode = graph.nodes[connection.from.nodeId];
final toNode = graph.nodes[connection.to.nodeId];
if (fromNode == null || toNode == null) return null;
final fromPort = fromNode.portById(connection.from.portId);
final toPort = toNode.portById(connection.to.portId);
if (fromPort == null || toPort == null) return null;
return (
from: NodeGeometry.portPosition(fromNode, fromPort, sizeOf(fromNode)),
to: NodeGeometry.portPosition(toNode, toPort, sizeOf(toNode)),
fromSide: fromPort.side,
toSide: toPort.side,
);
}