Skip to main content

Home > @jsplumbtoolkit/core > AbstractLayout > setPosition

AbstractLayout.setPosition() method

Sets the position of the node/group with the given id, and recalculates the extents.

Signature:

setPosition(id: string, x: number, y: number, doNotCalculateExtents?: boolean): Record<string, {
original: PointXY;
current: PointXY;
}>;

Parameters

ParameterTypeDescription
idstringID of the node/group to move
xnumberLeft position
ynumberTop position.
doNotCalculateExtentsbooleanIf true, do not recalculate the layout extents. we use this during a layout run, as we dont need to calculate the extents until it is finished. But for a single setPosition call, we do want to recalculate extents.

Returns:

Record<string, { original: PointXY; current: PointXY; }>