Skip to main content

Home > blockly > ConnectionDB > searchForClosest

ConnectionDB.searchForClosest() method

Find the closest compatible connection to this connection.

Signature:

searchForClosest(conn: RenderedConnection, maxRadius: number, dxy: Coordinate): {
connection: RenderedConnection | null;
radius: number;
};

Parameters

ParameterTypeDescription
connRenderedConnectionThe connection searching for a compatible mate.
maxRadiusnumberThe maximum radius to another connection.
dxyCoordinateOffset between this connection's location in the database and the current location (as a result of dragging).

Returns:

{ connection: RenderedConnection | null; radius: number; }

Contains two properties: 'connection' which is either another connection or null, and 'radius' which is the distance.