จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
blockly > ConnectionDB > searchForClosest
เมธอด ConnectionDB.searchForClosest()
ค้นหาการเชื่อมต่อที่เข้ากันได้ซึ่งใกล้เคียงที่สุดกับการเชื่อมต่อนี้
ลายเซ็น:
searchForClosest(conn: RenderedConnection, maxRadius: number, dxy: Coordinate): {
connection: RenderedConnection | null;
radius: number;
};
พารามิเตอร์
พารามิเตอร์ |
ประเภท |
คำอธิบาย |
Conn |
RenderedConnection |
การเชื่อมต่อที่กำลังมองหาคู่รักที่ใช้งานร่วมกันได้ |
maxRadius |
ตัวเลข |
รัศมีสูงสุดสำหรับการเชื่อมต่ออื่น |
dxy |
ประสานงาน |
ออฟเซ็ตระหว่างตำแหน่งของการเชื่อมต่อนี้ในฐานข้อมูลและตำแหน่งปัจจุบัน (เป็นผลมาจากการลาก) |
การคืนสินค้า:
{ connection: RenderedConnection | null; รัศมี: ตัวเลข; }
มีพร็อพเพอร์ตี้ 2 รายการ ได้แก่ "การเชื่อมต่อ" ซึ่งเป็นการเชื่อมต่ออื่นหรือค่าว่าง และ "รัศมี" ซึ่งเป็นระยะทาง
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[[["เข้าใจง่าย","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"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[],["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"]]