PortPositionExtension extension

Extension on PortPosition providing centralized port geometry calculations.

All port position-related calculations should use these methods to ensure consistency across the codebase. This includes:

  • Connection attachment points
  • Visual center positions
  • Widget origin positions
on

Properties

isHorizontal bool

Available on PortPosition, provided by the PortPositionExtension extension

Whether the perpendicular axis is horizontal (left/right ports) or vertical (top/bottom ports).
no setter
isVertical bool

Available on PortPosition, provided by the PortPositionExtension extension

Whether the perpendicular axis is vertical (top/bottom ports).
no setter
normal Offset

Available on PortPosition, provided by the PortPositionExtension extension

Returns the outward normal direction for this port position.
no setter

Methods

calculateOrigin({required Offset anchorOffset, required Size portSize, required Offset portAdjustment, required bool useAnchorForPerpendicularAxis}) Offset

Available on PortPosition, provided by the PortPositionExtension extension

Calculates the port widget's top-left origin position relative to an anchor.
connectionOffset(Size portSize) Offset

Available on PortPosition, provided by the PortPositionExtension extension

Returns the offset from port's top-left to the connection attachment point.
toOrientation() ShapeDirection

Available on PortPosition, provided by the PortPositionExtension extension

Converts to ShapeDirection for shape-based calculations.