סקר מחקר: נשמח לשמוע על החוויה שלך עם Blockly
לפתיחת הסקר
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
blockly > IConnectionChecker > canConnectWithReason
שיטת IConnectionChecker.canConnectWithReason()
הפונקציה בודקת אם החיבור הנוכחי יכול להתחבר לחיבור היעד, ומחזירה קוד שגיאה אם יש בעיות.
Signature:
canConnectWithReason(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): number;
פרמטרים
פרמטר |
סוג |
תיאור |
a |
חיבור | null |
חיבור כדי לבדוק את התאימות. |
b |
חיבור | null |
חיבור כדי לבדוק את התאימות. |
isDragging |
בוליאני |
הערך הוא True אם מתבצע חיבור על ידי גרירת בלוק. |
opt_distance |
number |
(אופציונלי) המרחק המקסימלי המותר בין החיבורים לצורך בדיקות גרירה. |
החזרות:
number
Connection.CAN_CONNECT אם החיבור חוקי. אחרת, קוד שגיאה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-28 (שעון 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-28 (שעון 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"]]