Stay organized with collections
Save and categorize content based on your preferences.
blockly > IMetricsManager > getViewMetrics
IMetricsManager.getViewMetrics() method
Gets the metrics for the visible workspace in either pixel or workspace coordinates. The visible workspace does not include the toolbox or flyout.
Signature:
getViewMetrics(opt_getWorkspaceCoordinates?: boolean): ContainerRegion;
Parameters
Parameter |
Type |
Description |
opt_getWorkspaceCoordinates |
boolean |
(Optional) True to get the view metrics in workspace coordinates, false to get them in pixel coordinates. |
Returns:
ContainerRegion
The width, height, top and left of the viewport in either workspace coordinates or pixel 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.
[[["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."],[[["`getViewMetrics()` returns the dimensions and position of the visible workspace area."],["This method provides measurements in either pixel or workspace coordinates, depending on the optional parameter."],["The returned metrics represent the viewport excluding the toolbox and flyout."]]],["The `getViewMetrics()` method retrieves the dimensions of the visible workspace, excluding the toolbox and flyout. It offers the option to return these metrics in either pixel or workspace coordinates via the `opt_getWorkspaceCoordinates` parameter (defaulting to pixel coordinates). The method returns a `ContainerRegion` object containing the width, height, top, and left values of the viewport.\n"]]