Skip to main content

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

Surface.fromPageLocation() method

Maps the given page location to a value relative to the viewport origin, 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:

fromPageLocation(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.