Stay organized with collections
Save and categorize content based on your preferences.
blockly > utils > Metrics
utils.Metrics interface
Signature:
export interface Metrics
Properties
Property |
Modifiers |
Type |
Description |
absoluteLeft |
|
number |
Left-edge of the visible portion of the workspace, relative to the blocklyDiv. |
absoluteTop |
|
number |
Top-edge of the visible portion of the workspace, relative to the blocklyDiv. |
contentHeight |
|
number |
Height of the content. |
contentLeft |
|
number |
Left-edge of the content relative to the workspace origin. |
contentTop |
|
number |
Top-edge of the content, relative to the workspace origin. |
contentWidth |
|
number |
Width of the content. |
flyoutHeight |
|
number |
Height of the flyout if it is always open. Otherwise zero. |
flyoutWidth |
|
number |
Width of the flyout if it is always open. Otherwise zero. |
scrollHeight |
|
number |
Height of the scroll area. |
scrollLeft |
|
number |
Left-edge of the scroll area relative to the workspace origin. |
scrollTop |
|
number |
Top-edge of the scroll area, relative to the workspace origin. |
scrollWidth |
|
number |
Width of the scroll area. |
svgHeight |
|
number |
Height of the Blockly div (the view + the toolbox, simple of otherwise). |
svgWidth |
|
number |
Width of the Blockly div (the view + the toolbox, simple or otherwise). |
toolboxHeight |
|
number |
Height of the toolbox, if it exists. Otherwise zero. |
toolboxPosition |
|
number |
Top, bottom, left or right. Use TOOLBOX_AT constants to compare. |
toolboxWidth |
|
number |
Width of the toolbox, if it exists. Otherwise zero. |
viewHeight |
|
number |
Height of the visible portion of the workspace. |
viewLeft |
|
number |
Left-edge of the visible portion of the workspace, relative to the workspace origin. |
viewTop |
|
number |
Top-edge of the visible portion of the workspace, relative to the workspace origin. |
viewWidth |
|
number |
Width of the visible portion of the workspace. |
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."],[[["\u003cp\u003eThe \u003ccode\u003eutils.Metrics\u003c/code\u003e interface provides various measurements related to the Blockly workspace and its components.\u003c/p\u003e\n"],["\u003cp\u003eThese measurements include dimensions and positions of elements like the workspace, content area, toolbox, flyout, and scroll area.\u003c/p\u003e\n"],["\u003cp\u003eMetrics are represented as numerical values and are relative to different origins, such as the Blockly div, workspace origin, or blocklyDiv.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use these metrics for tasks like positioning elements, calculating sizes, and managing the workspace layout.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [utils](./blockly.utils_namespace.md) \\\u003e [Metrics](./blockly.utils_namespace.metrics_interface.md)\n\nutils.Metrics interface\n-----------------------\n\n**Signature:** \n\n export interface Metrics \n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------------------------------------------|-----------|--------|--------------------------------------------------------------------------------------|\n| [absoluteLeft](./blockly.utils_namespace.metrics_interface.absoluteleft_propertysignature.md) | | number | Left-edge of the visible portion of the workspace, relative to the blocklyDiv. |\n| [absoluteTop](./blockly.utils_namespace.metrics_interface.absolutetop_propertysignature.md) | | number | Top-edge of the visible portion of the workspace, relative to the blocklyDiv. |\n| [contentHeight](./blockly.utils_namespace.metrics_interface.contentheight_propertysignature.md) | | number | Height of the content. |\n| [contentLeft](./blockly.utils_namespace.metrics_interface.contentleft_propertysignature.md) | | number | Left-edge of the content relative to the workspace origin. |\n| [contentTop](./blockly.utils_namespace.metrics_interface.contenttop_propertysignature.md) | | number | Top-edge of the content, relative to the workspace origin. |\n| [contentWidth](./blockly.utils_namespace.metrics_interface.contentwidth_propertysignature.md) | | number | Width of the content. |\n| [flyoutHeight](./blockly.utils_namespace.metrics_interface.flyoutheight_propertysignature.md) | | number | Height of the flyout if it is always open. Otherwise zero. |\n| [flyoutWidth](./blockly.utils_namespace.metrics_interface.flyoutwidth_propertysignature.md) | | number | Width of the flyout if it is always open. Otherwise zero. |\n| [scrollHeight](./blockly.utils_namespace.metrics_interface.scrollheight_propertysignature.md) | | number | Height of the scroll area. |\n| [scrollLeft](./blockly.utils_namespace.metrics_interface.scrollleft_propertysignature.md) | | number | Left-edge of the scroll area relative to the workspace origin. |\n| [scrollTop](./blockly.utils_namespace.metrics_interface.scrolltop_propertysignature.md) | | number | Top-edge of the scroll area, relative to the workspace origin. |\n| [scrollWidth](./blockly.utils_namespace.metrics_interface.scrollwidth_propertysignature.md) | | number | Width of the scroll area. |\n| [svgHeight](./blockly.utils_namespace.metrics_interface.svgheight_propertysignature.md) | | number | Height of the Blockly div (the view + the toolbox, simple of otherwise). |\n| [svgWidth](./blockly.utils_namespace.metrics_interface.svgwidth_propertysignature.md) | | number | Width of the Blockly div (the view + the toolbox, simple or otherwise). |\n| [toolboxHeight](./blockly.utils_namespace.metrics_interface.toolboxheight_propertysignature.md) | | number | Height of the toolbox, if it exists. Otherwise zero. |\n| [toolboxPosition](./blockly.utils_namespace.metrics_interface.toolboxposition_propertysignature.md) | | number | Top, bottom, left or right. Use TOOLBOX_AT constants to compare. |\n| [toolboxWidth](./blockly.utils_namespace.metrics_interface.toolboxwidth_propertysignature.md) | | number | Width of the toolbox, if it exists. Otherwise zero. |\n| [viewHeight](./blockly.utils_namespace.metrics_interface.viewheight_propertysignature.md) | | number | Height of the visible portion of the workspace. |\n| [viewLeft](./blockly.utils_namespace.metrics_interface.viewleft_propertysignature.md) | | number | Left-edge of the visible portion of the workspace, relative to the workspace origin. |\n| [viewTop](./blockly.utils_namespace.metrics_interface.viewtop_propertysignature.md) | | number | Top-edge of the visible portion of the workspace, relative to the workspace origin. |\n| [viewWidth](./blockly.utils_namespace.metrics_interface.viewwidth_propertysignature.md) | | number | Width of the visible portion of the workspace. |"]]