แบบสำรวจการวิจัย: บอกให้เราทราบเกี่ยวกับประสบการณ์การใช้งาน Blockly
เริ่มแบบสำรวจ
blockly > IConnectionChecker >
canConnectWithReason
เมธอด IConnectionChecker.canConnectWithReason()
ตรวจสอบว่าการเชื่อมต่อปัจจุบันเชื่อมต่อกับการเชื่อมต่อปลายทางได้หรือไม่ และแสดงผลรหัสข้อผิดพลาดหากมีปัญหา
ลายเซ็น:
canConnectWithReason(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): number;
พารามิเตอร์
พารามิเตอร์ |
ประเภท |
คำอธิบาย |
a |
การเชื่อมต่อ | ค่าว่าง |
การเชื่อมต่อเพื่อตรวจสอบความเข้ากันได้ |
b |
การเชื่อมต่อ | ค่าว่าง |
การเชื่อมต่อเพื่อตรวจสอบความเข้ากันได้ |
isDragging |
boolean |
เป็นจริงหากเชื่อมต่อด้วยการลากบล็อก |
opt_distance |
ตัวเลข |
(ไม่บังคับ) ระยะทางสูงสุดที่อนุญาตระหว่างการเชื่อมต่อสำหรับการตรวจสอบการลาก |
การคืนสินค้า:
ตัวเลข
Connection.CAN_CONNECT หากการเชื่อมต่อถูกต้อง รหัสข้อผิดพลาดจะแสดงไม่ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-08-21 UTC
[null,null,["อัปเดตล่าสุด 2024-08-21 UTC"],[[["The `canConnectWithReason` method determines if two connections are compatible, returning `Connection.CAN_CONNECT` for valid connections or an error code otherwise."],["It considers the connections (`a`, `b`), if a block is being dragged (`isDragging`), and optionally, the maximum allowed distance (`opt_distance`)."],["The method is part of the `IConnectionChecker` interface, which helps manage connection rules in Blockly."]]],["The `canConnectWithReason` method assesses the compatibility of two connections (`a` and `b`). It takes these connections, a boolean `isDragging` indicating a drag action, and an optional `opt_distance` parameter for drag distance checks. It returns a numerical value, either `Connection.CAN_CONNECT` for legal connections or a different error code indicating the problem. The connections being assessed could also be null.\n"]]