blockly > MetricsManager > getMetrics

MetricsManager.getMetrics() method

Returns an object with all the metrics required to size scrollbars for a top level workspace. The following properties are computed: Coordinate system: pixel coordinates, -left, -up, +right, +down .viewHeight: Height of the visible portion of the workspace. .viewWidth: Width of the visible portion of the workspace. .contentHeight: Height of the content. .contentWidth: Width of the content. .scrollHeight: Height of the scroll area. .scrollWidth: Width of the scroll area. .svgHeight: Height of the Blockly div (the view + the toolbox, simple or otherwise), .svgWidth: Width of the Blockly div (the view + the toolbox, simple or otherwise), .viewTop: Top-edge of the visible portion of the workspace, relative to the workspace origin. .viewLeft: Left-edge of the visible portion of the workspace, relative to the workspace origin. .contentTop: Top-edge of the content, relative to the workspace origin. .contentLeft: Left-edge of the content relative to the workspace origin. .scrollTop: Top-edge of the scroll area, relative to the workspace origin. .scrollLeft: Left-edge of the scroll area relative to the workspace origin. .absoluteTop: Top-edge of the visible portion of the workspace, relative to the blocklyDiv. .absoluteLeft: Left-edge of the visible portion of the workspace, relative to the blocklyDiv. .toolboxWidth: Width of the toolbox, if it exists. Otherwise zero. .toolboxHeight: Height of the toolbox, if it exists. Otherwise zero. .flyoutWidth: Width of the flyout if it is always open. Otherwise zero. .flyoutHeight: Height of the flyout if it is always open. Otherwise zero. .toolboxPosition: Top, bottom, left or right. Use TOOLBOX_AT constants to compare.

Signature:

getMetrics(): Metrics;

Returns:

Metrics

Contains size and position metrics of a top level workspace.