Class: RenderInfo

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_

non-null Blockly.zelos.ConstantProvider

hasStatementInput

boolean

Whether or not the block has a statement input in one of its rows.

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

inputRows

unknown

An array of input rows on the block.

Inherited from
Blockly.blockRendering.RenderInfo#inputRows

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.zelos.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

isMultiRow

boolean

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

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

rightSide

Blockly.zelos.RightConnectionShape

An object with rendering information about the right connection shape.

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

The row to add padding to.

missingSpace

How much padding to add.

Inherited from
Blockly.zelos.RenderInfo#addAlignmentPadding_

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.zelos.RenderInfo#addInput_

addRowSpacing_

protected

addRowSpacing_()

Add spacers between rows and set their sizes.

Inherited from
Blockly.blockRendering.RenderInfo#addRowSpacing_

adjustXPosition_

protected

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.

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_

finalizeHorizontalAlignment_

protected

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.

finalizeOutputConnection_

protected

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.

finalizeVerticalAlignment_

protected

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.

getDesiredRowWidth_

protected

getDesiredRowWidth_(_row) returns number

Calculate the desired width of an input row.

Parameter

_row

The input row.

Value must not be null.

Inherited from
Blockly.zelos.RenderInfo#getDesiredRowWidth_
Returns

The desired width of the input row.

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.zelos.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.

getNegativeSpacing_

protected

getNegativeSpacing_(elem) returns number

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

Parameter

elem

Blockly.blockRendering.Measurable

The first or last element on a block.

Returns

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

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.zelos.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

The previous row.

Value must not be null.

next

The next row.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#makeSpacerRow_
Returns

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.zelos.RenderInfo#measure

populateBottomRow_

package

populateBottomRow_()

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

Inherited from
Blockly.blockRendering.RenderInfo#populateBottomRow_

populateTopRow_

package

populateTopRow_()

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

Inherited from
Blockly.blockRendering.RenderInfo#populateTopRow_

recordElemPositions_

protected

recordElemPositions_(row)

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

Parameter

row

The row containing the elements.

Value must not be null.

Inherited from
Blockly.blockRendering.RenderInfo#recordElemPositions_

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.zelos.RenderInfo#shouldStartNewRow_
Returns

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