blockly > IConnectionChecker > canConnectWithReason
IConnectionChecker.canConnectWithReason() 方法
檢查目前的連線是否能與目標連線建立連線,並在發生問題時傳回錯誤代碼。
Signature:
canConnectWithReason(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): number;
參數
參數 | 類型 | 說明 |
---|---|---|
a | Connection | 空值 | 用於檢查相容性的連線。 |
b | Connection | 空值 | 用於檢查相容性的連線。 |
isDragging | boolean | 如果透過拖曳方塊建立連線,則為 True。 |
opt_distance | 號碼 | (選用) 拖曳檢查之間的連線距離上限。 |
傳回:
號碼
Connection.CAN_CONNECT 如果連線為合法連線,則顯示錯誤代碼。