Skip to main content

Class: FixedEdgesMetricsManager

Defined in: plugins/fixed-edges/src/index.js:42

The metrics manager for workspace metrics calculations with customizable fixed edges.

Param​

workspace

The workspace to calculate metrics for.

Implements​

Extends​

  • MetricsManager

Properties index​

PropertyDescription
workspace_The workspace to calculate metrics for.

Methods index​

MethodDescription
getAbsoluteMetricsGets the absolute left and absolute top in pixel coordinates. This is where the visible workspace starts in relation to the SVG container.
getComputedFixedEdges_Computes the fixed edges of the scroll area.
getContentMetricsGets content metrics in either pixel or workspace coordinates. The content area is a rectangle around all the top bounded elements on the workspace (workspace comments and blocks).
getDimensionsPx_Gets the dimensions of the given workspace component, in pixel coordinates.
getFlyoutMetricsGets the width and the height of the flyout in pixel coordinates. By default, will get metrics for either a simple flyout (owned directly by the workspace) or for the flyout owned by the toolbox. If you pass opt_own as true then only metrics for the simple flyout will be returned, and it will return 0 for the width and height if the workspace has a category toolbox instead of a simple toolbox.
getMetricsReturns 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.
getPaddedContent_Returns the content area with added padding.
getScrollMetricsReturns the metrics for the scroll area of the workspace.
getSvgMetricsGets the width and height of the workspace's parent SVG element in pixel coordinates. This area includes the toolbox and the visible workspace area.
getToolboxMetricsGets the width, height and position of the toolbox on the workspace in pixel coordinates. Returns 0 for the width and height if the workspace has a simple toolbox instead of a category toolbox. To get the width and height of a simple toolbox, see (MetricsManager:class).getFlyoutMetrics.
getUiMetricsReturns common metrics used by UI elements.
getViewMetricsGets the metrics for the visible workspace in either pixel or workspace coordinates. The visible workspace does not include the toolbox or flyout.
hasFixedEdgesReturns whether the scroll area has fixed edges.
setFixedEdgesSets which edges are fixed. This does not prevent fixed edges set by no scrollbars or single-direction scrollbars.

Constructors​

Constructor​

new FixedEdgesMetricsManager(workspace): FixedEdgesMetricsManager;

Defined in: plugins/fixed-edges/src/index.js:48

Constructor for fixed edges workspace metrics manager.

Parameters​

ParameterTypeDescription
workspaceWorkspaceSvgThe workspace that the plugin will be added to.

Returns​

FixedEdgesMetricsManager

Overrides​

Blockly.MetricsManager.constructor

Properties​

workspace_​

protected readonly workspace_: WorkspaceSvg;

The workspace to calculate metrics for.

Inherited from​

Blockly.MetricsManager.workspace_

Methods​

getAbsoluteMetrics()​

getAbsoluteMetrics(): AbsoluteMetrics;

Gets the absolute left and absolute top in pixel coordinates. This is where the visible workspace starts in relation to the SVG container.

Returns​

AbsoluteMetrics

The absolute metrics for the workspace.

Inherited from​

Blockly.MetricsManager.getAbsoluteMetrics


getComputedFixedEdges_()​

protected getComputedFixedEdges_(cachedViewMetrics?): FixedEdges;

Defined in: plugins/fixed-edges/src/index.js:85

Computes the fixed edges of the scroll area.

Parameters​

ParameterTypeDefault valueDescription
cachedViewMetrics?ContainerRegion | undefinedundefinedThe view metrics if they have been previously computed. Passing in null may cause the view metrics to be computed again, if it is needed.

Returns​

FixedEdges

The fixed edges of the scroll area.

Overrides​

Blockly.MetricsManager.getComputedFixedEdges_


getContentMetrics()​

getContentMetrics(opt_getWorkspaceCoordinates?): ContainerRegion;

Gets content metrics in either pixel or workspace coordinates. The content area is a rectangle around all the top bounded elements on the workspace (workspace comments and blocks).

Parameters​

ParameterTypeDescription
opt_getWorkspaceCoordinates?booleanTrue to get the content metrics in workspace coordinates, false to get them in pixel coordinates.

Returns​

ContainerRegion

The metrics for the content container.

Inherited from​

Blockly.MetricsManager.getContentMetrics


getDimensionsPx_()​

protected getDimensionsPx_(elem): Size;

Gets the dimensions of the given workspace component, in pixel coordinates.

Parameters​

ParameterTypeDescription
elemIToolbox | IFlyout | nullThe element to get the dimensions of, or null. It should be a toolbox or flyout, and should implement getWidth() and getHeight().

Returns​

Size

An object containing width and height attributes, which will both be zero if elem did not exist.

Inherited from​

Blockly.MetricsManager.getDimensionsPx_


getFlyoutMetrics()​

getFlyoutMetrics(opt_own?): ToolboxMetrics;

Gets the width and the height of the flyout in pixel coordinates. By default, will get metrics for either a simple flyout (owned directly by the workspace) or for the flyout owned by the toolbox. If you pass opt_own as true then only metrics for the simple flyout will be returned, and it will return 0 for the width and height if the workspace has a category toolbox instead of a simple toolbox.

Parameters​

ParameterTypeDescription
opt_own?booleanWhether to only return the workspace's own flyout metrics.

Returns​

ToolboxMetrics

The width and height of the flyout.

Inherited from​

Blockly.MetricsManager.getFlyoutMetrics


getMetrics()​

getMetrics(): Metrics;

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.

Returns​

Metrics

Contains size and position metrics of a top level workspace.

Inherited from​

Blockly.MetricsManager.getMetrics


getPaddedContent_()​

protected getPaddedContent_(viewMetrics, contentMetrics): object;

Returns the content area with added padding.

Parameters​

ParameterTypeDescription
viewMetricsContainerRegionThe view metrics.
contentMetricsContainerRegionThe content metrics.

Returns​

object

The padded content area.

bottom​
bottom: number;
left​
left: number;
right: number;
top​
top: number;

Inherited from​

Blockly.MetricsManager.getPaddedContent_


getScrollMetrics()​

getScrollMetrics(
opt_getWorkspaceCoordinates?,
opt_viewMetrics?,
opt_contentMetrics?
): ContainerRegion;

Returns the metrics for the scroll area of the workspace.

Parameters​

ParameterTypeDescription
opt_getWorkspaceCoordinates?booleanTrue to get the scroll metrics in workspace coordinates, false to get them in pixel coordinates.
opt_viewMetrics?ContainerRegionThe view metrics if they have been previously computed. Passing in null may cause the view metrics to be computed again, if it is needed.
opt_contentMetrics?ContainerRegionThe content metrics if they have been previously computed. Passing in null may cause the content metrics to be computed again, if it is needed.

Returns​

ContainerRegion

The metrics for the scroll container.

Inherited from​

Blockly.MetricsManager.getScrollMetrics


getSvgMetrics()​

getSvgMetrics(): Size;

Gets the width and height of the workspace's parent SVG element in pixel coordinates. This area includes the toolbox and the visible workspace area.

Returns​

Size

The width and height of the workspace's parent SVG element.

Inherited from​

Blockly.MetricsManager.getSvgMetrics


getToolboxMetrics()​

getToolboxMetrics(): ToolboxMetrics;

Gets the width, height and position of the toolbox on the workspace in pixel coordinates. Returns 0 for the width and height if the workspace has a simple toolbox instead of a category toolbox. To get the width and height of a simple toolbox, see (MetricsManager:class).getFlyoutMetrics.

Returns​

ToolboxMetrics

The object with the width, height and position of the toolbox.

Inherited from​

Blockly.MetricsManager.getToolboxMetrics


getUiMetrics()​

getUiMetrics(): UiMetrics;

Returns common metrics used by UI elements.

Returns​

UiMetrics

The UI metrics.

Inherited from​

Blockly.MetricsManager.getUiMetrics


getViewMetrics()​

getViewMetrics(opt_getWorkspaceCoordinates?): ContainerRegion;

Gets the metrics for the visible workspace in either pixel or workspace coordinates. The visible workspace does not include the toolbox or flyout.

Parameters​

ParameterTypeDescription
opt_getWorkspaceCoordinates?booleanTrue 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.

Inherited from​

Blockly.MetricsManager.getViewMetrics


hasFixedEdges()​

hasFixedEdges(): boolean;

Defined in: plugins/fixed-edges/src/index.js:71

Returns whether the scroll area has fixed edges.

Returns​

boolean

Whether the scroll area has fixed edges.

Package​

Overrides​

Blockly.MetricsManager.hasFixedEdges


setFixedEdges()​

static setFixedEdges(updatedFixedEdges): void;

Defined in: plugins/fixed-edges/src/index.js:58

Sets which edges are fixed. This does not prevent fixed edges set by no scrollbars or single-direction scrollbars.

Parameters​

ParameterTypeDescription
updatedFixedEdgesFixedEdgesConfigThe edges to set as fixed.

Returns​

void