blockly > BlockSvg > getRelativeToSurfaceXY
BlockSvg.getRelativeToSurfaceXY() method
Return the coordinates of the top-left corner of this block relative to the drawing surface's origin (0,0), in workspace units. If the block is on the workspace, (0, 0) is the origin of the workspace coordinate system. This does not change with workspace scale.
Signature:
getRelativeToSurfaceXY(): Coordinate;
Returns:
Coordinate
Object with .x and .y properties in workspace coordinates.
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."],[[["This method returns the top-left corner coordinates of a block relative to the drawing surface's origin (0,0) in workspace units."],["The returned coordinates are independent of workspace scaling and are represented as a Coordinate object with x and y properties."],["If the block is on the workspace, the origin (0, 0) refers to the workspace coordinate system's origin."]]],["The `getRelativeToSurfaceXY()` method, part of the `BlockSvg` class, returns the top-left corner coordinates of a block. These coordinates are relative to the drawing surface's origin (0,0) in workspace units. The output is a `Coordinate` object with `x` and `y` properties. The coordinates remain constant regardless of any workspace scaling. The block is relative to workspace if it is on the workspace.\n"]]