Skip to main content

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

Surface.toPageLocation() method

Maps the given location relative to the viewport origin, to a page location, allowing for zoom and pan of the canvas. This takes into account the offset of the viewport in the page so that what you get back is the mapped position relative to the target element's [left,top] corner. If you wish, you can supply true for 'doNotAdjustForOffset', to suppress that behavior.

Signature:

toPageLocation(left: number, top: number, doNotAdjustForOffset?: boolean): PointXY;

Parameters

ParameterTypeDescription
leftnumberX location
topnumberY location
doNotAdjustForOffsetbooleanWhether or not to adjust for the offset of the viewport in the page. Defaults to false.

Returns:

PointXY

The mapped location, as a PointXY object.