Skip to main content

Home > @jsplumbtoolkit/connector-editors > findClosestPoint

findClosestPoint() function

Find the closest point out of locations to the given point on the given constraining rectangle.

Signature:

export declare function findClosestPoint<T extends PointXY>(pos: PointXY, constrainRect: Size, locations: Array<T>): ClosestPointCandidate<T>;

Parameters

ParameterTypeDescription
posPointXYAn x,y location in pixel values
constrainRectSizeWidth/height of the bounding box, in pixels
locationsArray<T>A list of x/y logical locations, whose values are proportional lengths (anchor format).

Returns:

ClosestPointCandidate<T>