blockly > ConnectionChecker > canConnect

ConnectionChecker.canConnect() 方法

检查当前连接是否可以与目标连接连接。

Signature:

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

参数

参数 类型 说明
a 连接 | null 要检查其兼容性的连接。
b 连接 | null 要检查其兼容性的连接。
isDragging boolean 如果通过拖动块建立连接,则为 true。
opt_distance number (可选)拖动检查中连接点之间允许的最大距离。

返回

boolean

关联是否合法。