Namespace: uiPosition

Enumerations

bumpDirection

constant   package   static

number

Enum for bump rules to use for dealing with collisions.

Value

UP

DOWN

horizontalPosition

constant   package   static

number

Enum for horizontal positioning.

Value

LEFT

RIGHT

verticalPosition

constant   package   static

number

Enum for vertical positioning.

Value

TOP

BOTTOM

Properties

bumpDirection

constant   package   static

number

Enum for bump rules to use for dealing with collisions.

Value

UP

DOWN

horizontalPosition

constant   package   static

number

Enum for horizontal positioning.

Value

LEFT

RIGHT

verticalPosition

constant   package   static

number

Enum for vertical positioning.

Value

TOP

BOTTOM

Methods

bumpPositionRect

package   static

bumpPositionRect(startRect, margin, bumpDir, savedPositions) returns Blockly.utils.Rect

Returns a position Rect based on a starting position that is bumped so that it doesn't intersect with any of the provided savedPositions. This method does not check that the bumped position is still within bounds.

Parameter

startRect

Blockly.utils.Rect

The starting position to use.

Value must not be null.

margin

number

The margin to use between elements when bumping.

bumpDir

bumpDirection

The direction to bump if there is a collision with an existing UI element.

Value must not be null.

savedPositions

Array of non-null Rect

List of rectangles that represent the positions of UI elements already placed.

Value must not be null.

Returns

non-null Blockly.utils.Rect The suggested position rectangle.

getCornerOppositeToolbox

package   static

getCornerOppositeToolbox(workspace, metrics) returns Position

Returns a corner position that is on the opposite side of the workspace from the toolbox. If in horizontal orientation, defaults to the bottom corner. If in vertical orientation, defaults to the right corner.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace.

Value must not be null.

metrics

MetricsManager.UiMetrics

The workspace metrics.

Value must not be null.

Returns

non-null Position The suggested corner position.

getStartPositionRect

package   static

getStartPositionRect(position, size, horizontalPadding, verticalPadding, metrics, workspace) returns Blockly.utils.Rect

Returns a rectangle representing reasonable position for where to place a UI element of the specified size given the restraints and locations of the scrollbars. This method does not take into account any already placed UI elements.

Parameter

position

Position

The starting horizontal and vertical position.

Value must not be null.

size

Blockly.utils.Size

the size of the UI element to get a start position for.

Value must not be null.

horizontalPadding

number

The horizontal padding to use.

verticalPadding

number

The vertical padding to use.

metrics

MetricsManager.UiMetrics

The workspace UI metrics.

Value must not be null.

workspace

Blockly.WorkspaceSvg

The workspace.

Value must not be null.

Returns

non-null Blockly.utils.Rect The suggested start position.

Abstract type

Position

package   static

{horizontal: non-null horizontalPosition, vertical: non-null verticalPosition}

An object defining a horizontal and vertical positioning.