Skip to main content

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

Surface.getCoordinates() method

Gets the origin and size of the DOM element representing a Vertex that is being managed by the Surface. Origin is reported in pixels, relative to the parent container of the given Vertex: for a Vertex inside a group, the parent container is group's DOM element (or the group's DOM element's internal parent for children); for a Vertex that is at the root level of the dataset, the container is the canvas.

Signature:

getCoordinates(el: string | Element | Vertex, relativeToCanvasRoot?: boolean): RectangleXY;

Parameters

ParameterTypeDescription
elstring | Element | VertexVertex id, element, or Vertex to get position for.
relativeToCanvasRootbooleanDefaults to false, meaning the behaviour is as described above. If true, then all values are reported with respect to the canvas origin. This flag is used, for instance, in the copy/paste module, for determining the canvas offset for some node being copied out of a group into the root of the dataset.

Returns:

RectangleXY

A RectangleXY if element was found, otherwise null.