Skip to main content

Class: RenderInfo

Defined in: packages/blockly/core/renderers/zelos/info.ts:60

An object containing all sizing information needed to draw this block.

This measure pass does not propagate changes to the block (although fields may choose to rerender when getSize() is called). However, calling it repeatedly may be expensive.

Extends​

Properties index​

PropertyDescription
block_-
outputConnection-
isCollapsed-
isInsertionMarker-
RTL-
heightThe height of the rendered block, including child blocks.
widthWithChildrenThe width of the rendered block, including child blocks.
widthThe width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR.
statementEdge-
rowsAn array of Row objects containing sizing information.
inputRowsAn array of input rows on the block.
startX-
startY-
topRow-
bottomRow-
constants_-
renderer_The block renderer in use.
isInline-
isMultiRow-
hasStatementInput-
rightSide-

Methods index​

MethodDescription
createRows_Create rows of Measurable objects representing all renderable parts of the block.
populateTopRow_Create all non-spacer elements that belong on the top row.
populateBottomRow_Create all non-spacer elements that belong on the bottom row.
addElemSpacing_Add horizontal spacing between and around elements within each row.
computeBounds_Figure out where the right edge of the block and right edge of statement inputs should be placed.
alignRowElements_Extra spacing may be necessary to make sure that the right sides of all rows line up. This can only be calculated after a first pass to calculate the sizes of all rows.
alignStatementRow_Align the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places.
addRowSpacing_Add spacers between rows and set their sizes.
makeSpacerRow_Create a spacer row to go between prev and next, and set its size.
recordElemPositions_Record final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element.
getMeasureableForConnectionReturns the connection measurable associated with the given connection.
getRendererGet the block renderer in use.
measurePopulate this object with all sizing information needed to draw the block.
shouldStartNewRow_Decide whether to start a new row between the two Blockly.Inputs.
getDesiredRowWidth_Calculate the desired width of an input row.
getInRowSpacing_Calculate the width of a spacer element in a row based on the previous and next elements in that row. For instance, extra padding is added between two editable fields.
getSpacerRowHeight_Calculate the height of a spacer row.
getSpacerRowWidth_Calculate the width of a spacer row.
getElemCenterline_Calculate the centerline of an element in a rendered row. This base implementation puts the centerline at the middle of the row vertically, with no special cases. You will likely need extra logic to handle (at minimum) top and bottom rows.
addInput_Add an input element to the active row, if needed, and record the type of the input on the row.
addAlignmentPadding_Modify the given row to add the given amount of padding around its fields. The exact location of the padding is based on the alignment property of the last input in the field.
adjustXPosition_Adjust the x position of fields to bump all non-label fields in the first row past the notch position. This must be called before computeBounds is called.
finalizeOutputConnection_Finalize the output connection info. In particular, set the height of the output connection to match that of the block. For the right side, add a right connection shape element and have it match the dimensions of the output connection.
finalizeHorizontalAlignment_Finalize horizontal alignment of elements on the block. In particular, reduce the implicit spacing created by the left and right output connection shapes by adding setting negative spacing onto the leftmost and rightmost spacers.
getNegativeSpacing_Calculate the spacing to reduce the left and right edges by based on the outer and inner connection shape.
finalizeVerticalAlignment_Finalize vertical alignment of rows on a block. In particular, reduce the implicit spacing when a non-shadow block is connected to any of an input row's inline inputs.
finalize_Make any final changes to the rendering information object. In particular, store the y position of each row, and record the height of the full block.

Constructors​

Constructor​

new RenderInfo(renderer, block): RenderInfo;

Defined in: packages/blockly/core/renderers/zelos/info.ts:76

Parameters​

ParameterTypeDescription
rendererRendererThe renderer in use.
blockBlockSvgThe block to measure.

Returns​

RenderInfo

Overrides​

RenderInfo.constructor

Properties​

block_​

block_: BlockSvg;

Defined in: packages/blockly/core/renderers/common/info.ts:49

Inherited from​

RenderInfo.block_


outputConnection​

outputConnection:
| OutputConnection
| null;

Defined in: packages/blockly/core/renderers/common/info.ts:51

Inherited from​

RenderInfo.outputConnection


isCollapsed​

isCollapsed: boolean;

Defined in: packages/blockly/core/renderers/common/info.ts:53

Inherited from​

RenderInfo.isCollapsed


isInsertionMarker​

isInsertionMarker: boolean;

Defined in: packages/blockly/core/renderers/common/info.ts:54

Inherited from​

RenderInfo.isInsertionMarker


RTL​

RTL: boolean;

Defined in: packages/blockly/core/renderers/common/info.ts:55

Inherited from​

RenderInfo.RTL


height​

height: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:61

The height of the rendered block, including child blocks.

Inherited from​

RenderInfo.height


widthWithChildren​

widthWithChildren: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:64

The width of the rendered block, including child blocks.

Inherited from​

RenderInfo.widthWithChildren


width​

width: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:70

The width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR.

Inherited from​

RenderInfo.width


statementEdge​

statementEdge: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:71

Inherited from​

RenderInfo.statementEdge


rows​

rows: Row[] = [];

Defined in: packages/blockly/core/renderers/common/info.ts:74

An array of Row objects containing sizing information.

Inherited from​

RenderInfo.rows


inputRows​

inputRows: InputRow[] = [];

Defined in: packages/blockly/core/renderers/common/info.ts:77

An array of input rows on the block.

Inherited from​

RenderInfo.inputRows


startX​

startX: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:84

Inherited from​

RenderInfo.startX


startY​

startY: number = 0;

Defined in: packages/blockly/core/renderers/common/info.ts:85

Inherited from​

RenderInfo.startY


topRow​

topRow: TopRow;

Defined in: packages/blockly/core/renderers/zelos/info.ts:61

Overrides​

RenderInfo.topRow


bottomRow​

bottomRow: BottomRow;

Defined in: packages/blockly/core/renderers/zelos/info.ts:62

Overrides​

RenderInfo.bottomRow


constants_​

constants_: ConstantProvider;

Defined in: packages/blockly/core/renderers/zelos/info.ts:63

Overrides​

RenderInfo.constants_


renderer_​

renderer_: Renderer;

Defined in: packages/blockly/core/renderers/zelos/info.ts:64

The block renderer in use.

Overrides​

RenderInfo.renderer_


isInline​

isInline: boolean = true;

Defined in: packages/blockly/core/renderers/zelos/info.ts:66

Overrides​

RenderInfo.isInline


isMultiRow​

isMultiRow: boolean;

Defined in: packages/blockly/core/renderers/zelos/info.ts:67


hasStatementInput​

hasStatementInput: boolean;

Defined in: packages/blockly/core/renderers/zelos/info.ts:68


rightSide​

rightSide: RightConnectionShape | null;

Defined in: packages/blockly/core/renderers/zelos/info.ts:69

Methods​

createRows_()​

protected createRows_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:165

Create rows of Measurable objects representing all renderable parts of the block.

Returns​

void

Inherited from​

RenderInfo.createRows_


populateTopRow_()​

protected populateTopRow_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:217

Create all non-spacer elements that belong on the top row.

Returns​

void

Inherited from​

RenderInfo.populateTopRow_


populateBottomRow_()​

protected populateBottomRow_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:265

Create all non-spacer elements that belong on the bottom row.

Returns​

void

Inherited from​

RenderInfo.populateBottomRow_


addElemSpacing_()​

protected addElemSpacing_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:381

Add horizontal spacing between and around elements within each row.

Returns​

void

Inherited from​

RenderInfo.addElemSpacing_


computeBounds_()​

protected computeBounds_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:472

Figure out where the right edge of the block and right edge of statement inputs should be placed.

Returns​

void

Inherited from​

RenderInfo.computeBounds_


alignRowElements_()​

protected alignRowElements_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:516

Extra spacing may be necessary to make sure that the right sides of all rows line up. This can only be calculated after a first pass to calculate the sizes of all rows.

Returns​

void

Inherited from​

RenderInfo.alignRowElements_


alignStatementRow_()​

protected alignStatementRow_(row): void;

Defined in: packages/blockly/core/renderers/common/info.ts:585

Align the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places.

Parameters​

ParameterTypeDescription
rowInputRowThe statement row to resize.

Returns​

void

Inherited from​

RenderInfo.alignStatementRow_


addRowSpacing_()​

protected addRowSpacing_(): void;

Defined in: packages/blockly/core/renderers/common/info.ts:609

Add spacers between rows and set their sizes.

Returns​

void

Inherited from​

RenderInfo.addRowSpacing_


makeSpacerRow_()​

protected makeSpacerRow_(prev, next): SpacerRow;

Defined in: packages/blockly/core/renderers/common/info.ts:628

Create a spacer row to go between prev and next, and set its size.

Parameters​

ParameterTypeDescription
prevRowThe previous row.
nextRowThe next row.

Returns​

SpacerRow

The newly created spacer row.

Inherited from​

RenderInfo.makeSpacerRow_


recordElemPositions_()​

protected recordElemPositions_(row): void;

Defined in: packages/blockly/core/renderers/common/info.ts:700

Record final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element.

Parameters​

ParameterTypeDescription
rowRowThe row containing the elements.

Returns​

void

Inherited from​

RenderInfo.recordElemPositions_


getMeasureableForConnection()​

getMeasureableForConnection(conn): Connection | null;

Defined in: packages/blockly/core/renderers/common/info.ts:753

Returns the connection measurable associated with the given connection.

Parameters​

ParameterType
connRenderedConnection

Returns​

Connection | null

Inherited from​

RenderInfo.getMeasureableForConnection


getRenderer()​

getRenderer(): Renderer;

Defined in: packages/blockly/core/renderers/zelos/info.ts:123

Get the block renderer in use.

Returns​

Renderer

The block renderer in use.

Overrides​

RenderInfo.getRenderer


measure()​

measure(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:127

Populate this object with all sizing information needed to draw the block.

This measure pass does not propagate changes to the block (although fields may choose to rerender when getSize() is called). However, calling it repeatedly may be expensive.

Returns​

void

Overrides​

RenderInfo.measure


shouldStartNewRow_()​

shouldStartNewRow_(currInput, prevInput): boolean;

Defined in: packages/blockly/core/renderers/zelos/info.ts:138

Decide whether to start a new row between the two Blockly.Inputs.

Parameters​

ParameterTypeDescription
currInputInputThe current input.
prevInputInputThe previous input.

Returns​

boolean

True if the current input should be rendered on a new row.

Overrides​

RenderInfo.shouldStartNewRow_


getDesiredRowWidth_()​

getDesiredRowWidth_(row): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:167

Calculate the desired width of an input row.

Parameters​

ParameterTypeDescription
rowRowThe input row.

Returns​

number

The desired width of the input row.

Overrides​

RenderInfo.getDesiredRowWidth_


getInRowSpacing_()​

getInRowSpacing_(prev, next): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:176

Calculate the width of a spacer element in a row based on the previous and next elements in that row. For instance, extra padding is added between two editable fields.

Parameters​

ParameterTypeDescription
prevMeasurable | nullThe element before the spacer.
nextMeasurable | nullThe element after the spacer.

Returns​

number

The size of the spacing between the two elements.

Overrides​

RenderInfo.getInRowSpacing_


getSpacerRowHeight_()​

getSpacerRowHeight_(prev, next): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:217

Calculate the height of a spacer row.

Parameters​

ParameterTypeDescription
prevRowThe row before the spacer.
nextRowThe row after the spacer.

Returns​

number

The desired height of the spacer row between these two rows.

Overrides​

RenderInfo.getSpacerRowHeight_


getSpacerRowWidth_()​

getSpacerRowWidth_(prev, next): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:265

Calculate the width of a spacer row.

Parameters​

ParameterTypeDescription
prevRowThe row before the spacer.
nextRowThe row after the spacer.

Returns​

number

The desired width of the spacer row between these two rows.

Overrides​

RenderInfo.getSpacerRowWidth_


getElemCenterline_()​

getElemCenterline_(row, elem): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:276

Calculate the centerline of an element in a rendered row. This base implementation puts the centerline at the middle of the row vertically, with no special cases. You will likely need extra logic to handle (at minimum) top and bottom rows.

Parameters​

ParameterTypeDescription
rowRowThe row containing the element.
elemMeasurableThe element to place.

Returns​

number

The desired centerline of the given element, as an offset from the top left of the block.

Overrides​

RenderInfo.getElemCenterline_


addInput_()​

addInput_(input, activeRow): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:297

Add an input element to the active row, if needed, and record the type of the input on the row.

Parameters​

ParameterTypeDescription
inputInputThe input to record information about.
activeRowRowThe row that is currently being populated.

Returns​

void

Overrides​

RenderInfo.addInput_


addAlignmentPadding_()​

addAlignmentPadding_(row, missingSpace): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:323

Modify the given row to add the given amount of padding around its fields. The exact location of the padding is based on the alignment property of the last input in the field.

Parameters​

ParameterTypeDescription
rowRowThe row to add padding to.
missingSpacenumberHow much padding to add.

Returns​

void

Overrides​

RenderInfo.addAlignmentPadding_


adjustXPosition_()​

protected adjustXPosition_(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:352

Adjust the x position of fields to bump all non-label fields in the first row past the notch position. This must be called before computeBounds is called.

Returns​

void


finalizeOutputConnection_()​

protected finalizeOutputConnection_(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:415

Finalize the output connection info. In particular, set the height of the output connection to match that of the block. For the right side, add a right connection shape element and have it match the dimensions of the output connection.

Returns​

void


finalizeHorizontalAlignment_()​

protected finalizeHorizontalAlignment_(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:472

Finalize horizontal alignment of elements on the block. In particular, reduce the implicit spacing created by the left and right output connection shapes by adding setting negative spacing onto the leftmost and rightmost spacers.

Returns​

void


getNegativeSpacing_()​

protected getNegativeSpacing_(elem): number;

Defined in: packages/blockly/core/renderers/zelos/info.ts:526

Calculate the spacing to reduce the left and right edges by based on the outer and inner connection shape.

Parameters​

ParameterTypeDescription
elemMeasurableThe first or last element on a block.

Returns​

number

The amount of spacing to reduce the first or last spacer.


finalizeVerticalAlignment_()​

protected finalizeVerticalAlignment_(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:610

Finalize vertical alignment of rows on a block. In particular, reduce the implicit spacing when a non-shadow block is connected to any of an input row's inline inputs.

Returns​

void


finalize_()​

finalize_(): void;

Defined in: packages/blockly/core/renderers/zelos/info.ts:673

Make any final changes to the rendering information object. In particular, store the y position of each row, and record the height of the full block.

Returns​

void

Overrides​

RenderInfo.finalize_