NodePortGeometry<T> extension

Extension providing port geometry calculations for nodes.

This extension handles all port position calculations, including:

  • Visual port origins (where port widgets render)
  • Connection attachment points (where connection lines attach)
  • Port centers (for hit testing and highlighting)

The calculations account for node shapes and port-specific offsets, ensuring ports are correctly positioned on various node geometries.

Usage

final connectionPoint = node.getConnectionPoint(
  'port-id',
  portSize: Size(12, 12),
);
on

Methods

getConnectionPoint(String portId, {required Size portSize, NodeShape? shape}) Offset

Available on Node<T>, provided by the NodePortGeometry extension

Gets the connection attachment point for a port in graph coordinates.
getPortCapsuleSide(String portId) CapsuleFlatSide

Available on Node<T>, provided by the NodePortGeometry extension

Gets the capsule flat side orientation for a port.
getPortCenter(String portId, {required Size portSize, NodeShape? shape}) Offset

Available on Node<T>, provided by the NodePortGeometry extension

Gets the visual center of a port in graph coordinates.
getVisualPortOrigin(String portId, {required Size portSize, NodeShape? shape}) Offset

Available on Node<T>, provided by the NodePortGeometry extension

Gets the visual position where a port should be rendered within the node container.