getElementPosition property

Offset Function()? getElementPosition
final

Returns the current element position in graph coordinates.

When provided along with autoPan, getViewportBounds, and screenToGraph, enables automatic position clamping during drag operations. The element's position will be anchored at the inner bounds edge (viewport minus edge padding), ensuring it stays visible while the viewport pans behind it.

This is the position used for clamping calculations - typically the top-left corner of the element.

Example:

getElementPosition: () => node.visualPosition.value,

Implementation

final Offset Function()? getElementPosition;