Constructor

RenderInfo

new RenderInfo(renderer, block)

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.

Parameter

renderer

Blockly.zelos.Renderer

The renderer in use.

Value must not be null.

block

Blockly.BlockSvg

The block to measure.

Value must not be null.

Extends
Blockly.blockRendering.RenderInfo

Properties

bottomRow

unknown

An object with rendering information about the bottom row of the block.

Inherited from
Blockly.zelos.RenderInfo#bottomRow

constants_

protected

unknown

The renderer's constant provider.

Inherited from
Blockly.blockRendering.RenderInfo#constants_

height

unknown

The height of the rendered block, including child blocks.

Inherited from
Blockly.blockRendering.RenderInfo#height

hiddenIcons

unknown

An array of measurable objects containing hidden icons.

Inherited from
Blockly.blockRendering.RenderInfo#hiddenIcons

isCollapsed

unknown

Whether the block is collapsed.

Inherited from
Blockly.blockRendering.RenderInfo#isCollapsed

isInline

unknown

Whether the block should be rendered as a single line, either because it's inline or because it has been collapsed.

Inherited from
Blockly.blockRendering.RenderInfo#isInline

isInsertionMarker

unknown

Whether the block is an insertion marker. Insertion markers are the same shape as normal blocks, but don't show fields.

Inherited from
Blockly.blockRendering.RenderInfo#isInsertionMarker

outputConnection

unknown

A measurable representing the output connection if the block has one. Otherwise null.

Inherited from
Blockly.blockRendering.RenderInfo#outputConnection

renderer_

non-null Blockly.zelos.Renderer

rows

unknown

An array of Row objects containing sizing information.

Inherited from
Blockly.blockRendering.RenderInfo#rows

RTL

unknown

True if the block should be rendered right-to-left.

Inherited from
Blockly.blockRendering.RenderInfo#RTL

statementEdge

unknown

Inherited from
Blockly.blockRendering.RenderInfo#statementEdge

topRow

unknown

An object with rendering information about the top row of the block.

Inherited from
Blockly.zelos.RenderInfo#topRow

width

unknown

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

Inherited from
Blockly.blockRendering.RenderInfo#width

widthWithChildren

unknown

The width of the rendered block, including child blocks.

Inherited from
Blockly.blockRendering.RenderInfo#widthWithChildren

Methods

addAlignmentPadding_

protected

addAlignmentPadding_(row, missingSpace)

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.

Parameter

row

Blockly.blockRendering.Row

The row to add padding to.

missingSpace

number

How much padding to add.

addElemSpacing_

protected

addElemSpacing_()

Add horizontal spacing between and around elements within each row.

Inherited from
Blockly.blockRendering.RenderInfo#addElemSpacing_

addInput_

protected

addInput_(input, activeRow)

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

Parameter

input

The input to record information about.

Value must not be null.

activeRow

The row that is currently being populated.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#addInput_

addRowSpacing_

protected

addRowSpacing_()

Add spacers between rows and set their sizes.

Inherited from
Blockly.blockRendering.RenderInfo#addRowSpacing_

alignRowElements_

protected

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.

Inherited from
Blockly.blockRendering.RenderInfo#alignRowElements_

alignStatementRow_

protected

alignStatementRow_(row)

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

Parameter

row

The statement row to resize.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#alignStatementRow_

computeBounds_

protected

computeBounds_()

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

Inherited from
Blockly.blockRendering.RenderInfo#computeBounds_

createRows_

protected

createRows_()

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

Inherited from
Blockly.blockRendering.RenderInfo#createRows_

finalize_

protected

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.

Inherited from
Blockly.zelos.RenderInfo#finalize_

getElemCenterline_

protected

getElemCenterline_(row, elem) returns number

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.

Parameter

row

The row containing the element.

Value must not be null.

elem

The element to place.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#getElemCenterline_
Returns

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

getInRowSpacing_

protected

getInRowSpacing_(prev, next) returns number

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.

Parameter

prev

The element before the spacer.

next

The element after the spacer.

Inherited from
Blockly.zelos.RenderInfo#getInRowSpacing_
Returns

The size of the spacing between the two elements.

getRenderer

package

getRenderer() returns Blockly.zelos.Renderer

Get the block renderer in use.

Returns

non-null Blockly.zelos.Renderer The block renderer in use.

getSpacerRowHeight_

protected

getSpacerRowHeight_(_prev, _next) returns number

Calculate the height of a spacer row.

Parameter

_prev

The row before the spacer.

Value must not be null.

_next

The row after the spacer.

Value must not be null.

Inherited from
Blockly.zelos.RenderInfo#getSpacerRowHeight_
Returns

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

getSpacerRowWidth_

protected

getSpacerRowWidth_(_prev, _next) returns number

Calculate the width of a spacer row.

Parameter

_prev

The row before the spacer.

Value must not be null.

_next

The row after the spacer.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#getSpacerRowWidth_
Returns

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

makeSpacerRow_

protected

makeSpacerRow_(prev, next) returns Blockly.blockRendering.SpacerRow

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

Parameter

prev

Blockly.blockRendering.Row

The previous row, or null.

Value may be null.

next

Blockly.blockRendering.Row

The next row, or null.

Value may be null.

Returns

non-null Blockly.blockRendering.SpacerRow The newly created spacer row.

measure

package

measure()

Populate and return 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.

Inherited from
Blockly.blockRendering.RenderInfo#measure

populateBottomRow_

package

populateBottomRow_()

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

Inherited from
Blockly.zelos.RenderInfo#populateBottomRow_

populateTopRow_

package

populateTopRow_()

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

Inherited from
Blockly.zelos.RenderInfo#populateTopRow_

shouldStartNewRow_

protected

shouldStartNewRow_(input, lastInput) returns boolean

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

Parameter

input

The first input to consider

Value must not be null.

lastInput

The input that follows.

Inherited from
Blockly.blockRendering.RenderInfo#shouldStartNewRow_
Returns

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