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:
- Position the endpoint marker (arrow, circle, etc.) just outside the port
- Ensure the connection line starts/ends at the edge of the endpoint marker
- 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:
- ConnectionEndPoint for endpoint marker configuration
- PortPosition for port orientations
Constructors
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.