使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly > ConnectionChecker > canConnect
ConnectionChecker.canConnect() 方法
检查当前连接能否与目标连接建立连接。
Signature:
canConnect(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): boolean;
参数
参数 |
类型 |
说明 |
a |
连接 | null |
用于检查兼容性的连接。 |
b |
连接 | null |
要检查兼容性的连接。 |
isDragging |
布尔值 |
如果连接是通过拖动块进行的,则为 true。 |
opt_distance |
数值 |
(可选)拖动检查连接之间允许的最长距离。 |
返回:
布尔值
连接是否合法。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],["The `canConnect` method in `ConnectionChecker` verifies if two connections (`a` and `b`) are compatible. It takes two connection objects, a boolean (`isDragging`) indicating if a block is being dragged, and an optional `opt_distance` parameter for drag distance checks. It returns a boolean value indicating whether the connection between the provided connections is permitted. The method determines if it's valid for connections 'a' and 'b' to be linked.\n"]]