Skip to main content

Home > @jsplumbtoolkit/browser-ui > Surface > setPosition

Surface.setPosition() method#

Sets the position of the given vertex, snapping it to a grid and applying the magnetizer, if necessary. Other elements may be moved as a result of this method due to the magnetizer. For each moved element, a node moved event is fired. All of the move events are contained within a single transaction on the Toolkit so if you undo this operation, all of the affected elements will return to where they were prior to the move.

Signature:

setPosition(vertex: string | Node | Group | Element, x: number, y: number): void;

Parameters#

ParameterTypeDescription
vertexstring | Node | Group | ElementThe vertex to set the position for
xnumberX position to set
ynumberY position to set

Returns:

void