EndpointPositionCalculator class

Utility class for calculating endpoint marker and connection line positions.

This calculator determines the exact positions where endpoint markers should be drawn and where connection lines should start/end, taking into account port positions, sizes, and endpoint marker dimensions.

Purpose

When rendering connections, we need to:

  1. Position the endpoint marker (arrow, circle, etc.) just outside the port
  2. Ensure the connection line starts/ends at the edge of the endpoint marker
  3. Account for port orientation (left, right, top, bottom)

Usage Example

final points = EndpointPositionCalculator.calculatePortConnectionPoints(
  portPos: Offset(100, 50),
  portPosition: PortPosition.right,
  endpointSize: 5.0,
  portSize: 8.0,
);

// Draw endpoint marker at points.endpointPos
// Start connection line at points.linePos

See also:

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

calculatePortConnectionPoints(Offset portPos, PortPosition portPosition, double endpointSize, double portSize) → ({Offset endpointPos, Offset linePos})
Calculates endpoint marker and line positions for a port connection.