Blockly 于 2025 年 11 月 10 日移至 Raspberry Pi Foundation!请阅读博文和常见问题解答。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >ConnectionDB >searchForClosest
ConnectionDB.searchForClosest() 方法
查找与此连接距离最近的兼容连接。
Signature:
searchForClosest(conn: RenderedConnection, maxRadius: number, dxy: Coordinate): {
connection: RenderedConnection | null;
radius: number;
};
参数
| 参数 |
类型 |
说明 |
| 康恩 |
RenderedConnection |
寻找兼容伴侣的连接。 |
| maxRadius |
number |
到另一连接的最大半径。 |
| dxy |
坐标 |
此连接在数据库中的位置与当前位置(因拖动产生的)之间的偏移量。 |
返回:
{ connection: RenderedConnection |null;radius:number;}
包含两个属性:“连接”该参数为另一个连接或 null。即距离。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[],["The `searchForClosest()` method in `ConnectionDB` locates the nearest compatible connection. It takes a `RenderedConnection` (`conn`), a `maxRadius` (number), and a `Coordinate` (`dxy`) for location offset as parameters. It returns an object containing two properties: `connection`, which is either a found `RenderedConnection` or `null`, and `radius`, the distance to the found connection. The method identifies the closest matching connection within the defined radius.\n"]]