透過集合功能整理內容
你可以依據偏好儲存及分類內容。
封鎖 >ConnectionChecker
ConnectionChecker 類別
連線類型檢查邏輯的類別。
Signature:
export declare class ConnectionChecker implements IConnectionChecker
實作: IConnectionChecker
方法
方法 |
修飾符 |
說明 |
canConnect(a, b, isDragging, opt_distance) |
|
檢查目前的連線是否能連線到目標連線。 |
canConnectToPrevious_(a, b) |
protected |
用於拖曳檢查的輔助函式。 |
canConnectWithReason(a, b, isDragging, opt_distance) |
|
檢查目前的連線是否能與目標連線連線,並在發生問題時傳回錯誤代碼。 |
doDragChecks(a, b, distance) |
|
透過拖曳檢查是否能建立連線。 |
doSafetyChecks(a, b) |
|
檢查指定連線是否安全,這表示該連線不會破壞 Blockly 的任何基本假設 (例如沒有自我連線)。 |
doTypeChecks(a, b) |
|
檢查該連線是否與值類型系統的其他連線相容。例如:Square_root("Hello") 不相容。 |
getErrorMessage(errorCode, a, b) |
|
可將連線錯誤代碼轉譯為字串的輔助方法。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],["The `ConnectionChecker` class, implementing `IConnectionChecker`, manages connection type checking in the Blockly system. Key actions include determining if two connections can link via the `canConnect` and `canConnectWithReason` methods, with the latter also providing error codes. It assesses drag-related connections via `doDragChecks` and verifies safety using `doSafetyChecks`. Type compatibility is handled by `doTypeChecks`. Additionally, `getErrorMessage` provides readable error messages and `canConnectToPrevious_` is used for drag checking.\n"],null,[]]