Skip to main content

Class: TopRow

Defined in: packages/blockly/core/renderers/zelos/measurables/top_row.ts:21

An object containing information about what elements are in the top row of a block as well as sizing information for the top row. Elements in a top row can consist of corners, hats, spacers, and previous connections. After this constructor is called, the row will contain all non-spacer elements it needs.

Extends

Properties index

PropertyDescription
type-
elementsAn array of elements contained in this row.
heightThe height of the row.
widthThe width of the row, from the left edge of the block to the right. Does not include child blocks unless they are inline.
minHeightThe minimum height of the row.
minWidthThe minimum width of the row, from the left edge of the block to the right. Does not include child blocks unless they are inline.
widthWithConnectedBlocksThe width of the row, from the left edge of the block to the edge of the block or any connected child blocks.
yPosThe Y position of the row relative to the origin of the block's svg group.
xPosThe X position of the row relative to the origin of the block's svg group.
hasExternalInputWhether the row has any external inputs.
hasStatementWhether the row has any statement inputs.
statementEdgeWhere the left edge of all of the statement inputs on the block should be. This makes sure that statement inputs which are proceded by fields of varius widths are all aligned.
hasInlineInputWhether the row has any inline inputs.
hasDummyInputWhether the row has any dummy inputs or end-row inputs.
hasJaggedEdgeWhether the row has a jagged edge.
notchOffset-
alignAlignment of the row.
constants_-
caplineThe starting point for drawing the row, in the y direction. This allows us to draw hats and similar shapes that don't start at the origin. Must be non-negative (see #2820).
ascenderHeightHow much the row extends up above its capline.
hasPreviousConnectionWhether the block has a previous connection.
connectionThe previous connection on the block, if any.

Methods index

MethodDescription
getLastInputGet the last input on this row, if it has one.
getFirstSpacerConvenience method to get the first spacer element on this row.
getLastSpacerConvenience method to get the last spacer element on this row.
measureInspect all subcomponents and populate all size properties on the row.
startsWithElemSpacerDetermines whether this row should start with an element spacer.
endsWithElemSpacerDetermines whether this row should end with an element spacer.
hasLeftSquareCornerRender a round corner unless the block has an output connection.
hasRightSquareCornerRender a round corner unless the block has an output connection.

Constructors

Constructor

new TopRow(constants): TopRow;

Defined in: packages/blockly/core/renderers/zelos/measurables/top_row.ts:25

Parameters

ParameterTypeDescription
constantsConstantProviderThe rendering constants provider.

Returns

TopRow

Overrides

TopRow.constructor

Properties

type

type: number;

Defined in: packages/blockly/core/renderers/measurables/row.ts:20

Inherited from

TopRow.type


elements

elements: Measurable[] = [];

Defined in: packages/blockly/core/renderers/measurables/row.ts:25

An array of elements contained in this row.

Inherited from

TopRow.elements


height

height: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:30

The height of the row.

Inherited from

TopRow.height


width

width: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:36

The width of the row, from the left edge of the block to the right. Does not include child blocks unless they are inline.

Inherited from

TopRow.width


minHeight

minHeight: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:41

The minimum height of the row.

Inherited from

TopRow.minHeight


minWidth

minWidth: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:47

The minimum width of the row, from the left edge of the block to the right. Does not include child blocks unless they are inline.

Inherited from

TopRow.minWidth


widthWithConnectedBlocks

widthWithConnectedBlocks: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:53

The width of the row, from the left edge of the block to the edge of the block or any connected child blocks.

Inherited from

TopRow.widthWithConnectedBlocks


yPos

yPos: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:59

The Y position of the row relative to the origin of the block's svg group.

Inherited from

TopRow.yPos


xPos

xPos: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:65

The X position of the row relative to the origin of the block's svg group.

Inherited from

TopRow.xPos


hasExternalInput

hasExternalInput: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/row.ts:70

Whether the row has any external inputs.

Inherited from

TopRow.hasExternalInput


hasStatement

hasStatement: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/row.ts:75

Whether the row has any statement inputs.

Inherited from

TopRow.hasStatement


statementEdge

statementEdge: number = 0;

Defined in: packages/blockly/core/renderers/measurables/row.ts:82

Where the left edge of all of the statement inputs on the block should be. This makes sure that statement inputs which are proceded by fields of varius widths are all aligned.

Inherited from

TopRow.statementEdge


hasInlineInput

hasInlineInput: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/row.ts:87

Whether the row has any inline inputs.

Inherited from

TopRow.hasInlineInput


hasDummyInput

hasDummyInput: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/row.ts:92

Whether the row has any dummy inputs or end-row inputs.

Inherited from

TopRow.hasDummyInput


hasJaggedEdge

hasJaggedEdge: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/row.ts:97

Whether the row has a jagged edge.

Inherited from

TopRow.hasJaggedEdge


notchOffset

notchOffset: number;

Defined in: packages/blockly/core/renderers/measurables/row.ts:98

Inherited from

TopRow.notchOffset


align

align: number | null = null;

Defined in: packages/blockly/core/renderers/measurables/row.ts:103

Alignment of the row.

Inherited from

TopRow.align


constants_

protected readonly constants_: ConstantProvider;

Defined in: packages/blockly/core/renderers/measurables/row.ts:105

Inherited from

TopRow.constants_


capline

capline: number = 0;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:29

The starting point for drawing the row, in the y direction. This allows us to draw hats and similar shapes that don't start at the origin. Must be non-negative (see #2820).

Inherited from

TopRow.capline


ascenderHeight

ascenderHeight: number = 0;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:32

How much the row extends up above its capline.

Inherited from

TopRow.ascenderHeight


hasPreviousConnection

hasPreviousConnection: boolean = false;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:35

Whether the block has a previous connection.

Inherited from

TopRow.hasPreviousConnection


connection

connection:
| PreviousConnection
| null = null;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:38

The previous connection on the block, if any.

Inherited from

TopRow.connection

Methods

getLastInput()

getLastInput():
| InputConnection
| null;

Defined in: packages/blockly/core/renderers/measurables/row.ts:125

Get the last input on this row, if it has one.

Returns

| InputConnection | null

The last input on the row, or null.

Inherited from

TopRow.getLastInput


getFirstSpacer()

getFirstSpacer(): InRowSpacer | null;

Defined in: packages/blockly/core/renderers/measurables/row.ts:166

Convenience method to get the first spacer element on this row.

Returns

InRowSpacer | null

The first spacer element on this row.

Inherited from

TopRow.getFirstSpacer


getLastSpacer()

getLastSpacer(): InRowSpacer | null;

Defined in: packages/blockly/core/renderers/measurables/row.ts:181

Convenience method to get the last spacer element on this row.

Returns

InRowSpacer | null

The last spacer element on this row.

Inherited from

TopRow.getLastSpacer


measure()

measure(): void;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:79

Inspect all subcomponents and populate all size properties on the row.

Returns

void

Inherited from

TopRow.measure


startsWithElemSpacer()

startsWithElemSpacer(): boolean;

Defined in: packages/blockly/core/renderers/measurables/top_row.ts:101

Determines whether this row should start with an element spacer.

Returns

boolean

Whether the row should start with a spacer.

Inherited from

TopRow.startsWithElemSpacer


endsWithElemSpacer()

endsWithElemSpacer(): boolean;

Defined in: packages/blockly/core/renderers/zelos/measurables/top_row.ts:29

Determines whether this row should end with an element spacer.

Returns

boolean

Whether the row should end with a spacer.

Overrides

TopRow.endsWithElemSpacer


hasLeftSquareCorner()

hasLeftSquareCorner(block): boolean;

Defined in: packages/blockly/core/renderers/zelos/measurables/top_row.ts:34

Render a round corner unless the block has an output connection.

Parameters

ParameterType
blockBlockSvg

Returns

boolean

Overrides

TopRow.hasLeftSquareCorner


hasRightSquareCorner()

hasRightSquareCorner(block): boolean;

Defined in: packages/blockly/core/renderers/zelos/measurables/top_row.ts:43

Render a round corner unless the block has an output connection.

Parameters

ParameterType
blockBlockSvg

Returns

boolean

Overrides

TopRow.hasRightSquareCorner