Stay organized with collections
Save and categorize content based on your preferences.
blockly > ConnectionChecker
ConnectionChecker class
Class for connection type checking logic.
Signature:
export declare class ConnectionChecker implements IConnectionChecker
Implements: IConnectionChecker
Methods
Method |
Modifiers |
Description |
canConnect(a, b, isDragging, opt_distance) |
|
Check whether the current connection can connect with the target connection. |
canConnectToPrevious_(a, b) |
protected |
Helper function for drag checking. |
canConnectWithReason(a, b, isDragging, opt_distance) |
|
Checks whether the current connection can connect with the target connection, and return an error code if there are problems. |
doDragChecks(a, b, distance) |
|
Check whether this connection can be made by dragging. |
doSafetyChecks(a, b) |
|
Check that connecting the given connections is safe, meaning that it would not break any of Blockly's basic assumptions (e.g. no self connections). |
doTypeChecks(a, b) |
|
Check whether this connection is compatible with another connection with respect to the value type system. E.g. square_root("Hello") is not compatible. |
getErrorMessage(errorCode, a, b) |
|
Helper method that translates a connection error code into a string. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `ConnectionChecker` class in Blockly manages the logic for validating connections between blocks."],["It provides methods to check connection compatibility based on type, safety, and drag restrictions."],["These checks ensure that connections adhere to Blockly's rules and prevent invalid block configurations."],["Developers can use `ConnectionChecker` to determine if two connections can be joined and understand the reasons for any connection failures."]]],["The `ConnectionChecker` class, implementing `IConnectionChecker`, manages connection type checking in the Blockly system. Key actions include determining if two connections can link via the `canConnect` and `canConnectWithReason` methods, with the latter also providing error codes. It assesses drag-related connections via `doDragChecks` and verifies safety using `doSafetyChecks`. Type compatibility is handled by `doTypeChecks`. Additionally, `getErrorMessage` provides readable error messages and `canConnectToPrevious_` is used for drag checking.\n"]]