Table of Contents

Class PortPositionExtensions

Namespace
FlowGraph.Core
Assembly
FlowGraph.Core.dll

Extension methods for PortPosition.

public static class PortPositionExtensions
Inheritance
PortPositionExtensions
Inherited Members

Methods

ToIncomingArrowAngle(PortPosition)

Gets the arrow angle in radians for an edge entering a port from the given side. This follows the GoJS convention where the angle represents the direction the arrow points.

public static double ToIncomingArrowAngle(this PortPosition position)

Parameters

position PortPosition

The port position (side of node where port is located).

Returns

double

The angle in radians:

  • Left → π (180°) - arrow points left (edge enters from left)
  • Right → 0 - arrow points right (edge enters from right)
  • Top → -π/2 (-90°) - arrow points up (edge enters from top)
  • Bottom → π/2 (90°) - arrow points down (edge enters from bottom)

Remarks

This method is designed for marker/arrowhead direction calculation. The arrow points in the direction the edge is traveling when it reaches the target port.

For a left-to-right flow (source on right side of node A, target on left side of node B), the target port position is Left, so the arrow should point right (angle = 0) to indicate the edge is entering from the left.

This follows industry patterns from GoJS (getLinkDirection), React Flow (handleDirections), and mxGraph (DIRECTION_MASK).

ToOutgoingAngle(PortPosition)

Gets the outgoing direction angle in radians for an edge leaving from the given port side.

public static double ToOutgoingAngle(this PortPosition position)

Parameters

position PortPosition

The port position (side of node where port is located).

Returns

double

The angle in radians representing the initial direction of an outgoing edge.