blockly > RenderedConnection > distanceFrom
RenderedConnection.distanceFrom() method
Returns the distance between this connection and another connection in workspace units.
Signature:
distanceFrom(otherConnection: Connection): number;
Parameters
Parameter |
Type |
Description |
otherConnection |
Connection |
The other connection to measure the distance to. |
Returns:
number
The distance between connections, in workspace units.
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `distanceFrom()` method calculates the distance between two connections in a Blockly workspace."],["It takes another connection as input and returns the distance between them as a numerical value representing workspace units."]]],["The `distanceFrom()` method, part of the `RenderedConnection` class, calculates the distance between two connections. It accepts one parameter, `otherConnection`, of type `Connection`, representing the connection to measure against. The method returns a `number` value, which represents the distance separating the two connections, measured in workspace units. The core action is the calculation of the distance, with the other connection serving as the reference point.\n"]]