offset property

  1. @OffsetConverter()
Offset offset
final

Position offset that specifies where the CENTER of the port should be.

The offset interpretation depends on the port's position:

  • Left/Right ports: offset.dy is the vertical center position (distance from the top of the node). offset.dx adjusts the horizontal position from the edge.
  • Top/Bottom ports: offset.dx is the horizontal center position (distance from the left of the node). offset.dy adjusts the vertical position from the edge.

Example for a 150x100 node:

// Right port centered vertically at 50 (middle of node)
Port(position: PortPosition.right, offset: Offset(0, 50))

// Top port centered horizontally at 75 (middle of node width)
Port(position: PortPosition.top, offset: Offset(75, 0))

// Two right ports at 1/3 and 2/3 height
Port(position: PortPosition.right, offset: Offset(0, 33))
Port(position: PortPosition.right, offset: Offset(0, 67))

Implementation

@OffsetConverter()
final Offset offset;