Stay organized with collections Save and categorize content based on your preferences.

blockly > IConnectionChecker > canConnect

IConnectionChecker.canConnect() method

Check whether the current connection can connect with the target connection.

Signature:

canConnect(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): boolean;

Parameters

Parameter Type Description
a Connection | null Connection to check compatibility with.
b Connection | null Connection to check compatibility with.
isDragging boolean True if the connection is being made by dragging a block.
opt_distance number (Optional) The max allowable distance between the connections for drag checks.

Returns:

boolean

Whether the connection is legal.