Skip to main content

Home > blockly > blockRendering > RenderInfo

blockRendering.RenderInfo class

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.

Signature:

export declare class RenderInfo 

Constructors

ConstructorModifiersDescription
(constructor)(renderer, block)Constructs a new instance of the RenderInfo class

Properties

PropertyModifiersTypeDescription
block_BlockSvg
bottomRowBottomRow
constants_protectedConstantProvider
heightnumberThe height of the rendered block, including child blocks.
inputRowsInputRow[]An array of input rows on the block.
isCollapsedboolean
isInlineboolean
isInsertionMarkerboolean
outputConnectionOutputConnection | null
renderer_protected readonlyRendererThe block renderer in use.
rowsRow[]An array of Row objects containing sizing information.
RTLboolean
startXnumber
startYnumber
statementEdgenumber
topRowTopRow
widthnumberThe width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR.
widthWithChildrennumberThe width of the rendered block, including child blocks.

Methods

MethodModifiersDescription
addAlignmentPadding_(row, missingSpace)protectedModify 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.
addElemSpacing_()protectedAdd horizontal spacing between and around elements within each row.
addInput_(input, activeRow)protectedAdd an input element to the active row, if needed, and record the type of the input on the row.
addRowSpacing_()protectedAdd spacers between rows and set their sizes.
alignRowElements_()protectedExtra 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_(row)protectedAlign the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places.
computeBounds_()protectedFigure out where the right edge of the block and right edge of statement inputs should be placed.
createRows_()protectedCreate rows of Measurable objects representing all renderable parts of the block.
finalize_()protectedMake 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.
getDesiredRowWidth_(_row)protectedCalculate the desired width of an input row.
getElemCenterline_(row, elem)protectedCalculate 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.
getInRowSpacing_(prev, next)protectedCalculate 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.
getMeasureableForConnection(conn)Returns the connection measurable associated with the given connection.
getRenderer()Get the block renderer in use.
getSpacerRowHeight_(_prev, _next)protectedCalculate the height of a spacer row.
getSpacerRowWidth_(_prev, _next)protectedCalculate the width of a spacer row.
makeSpacerRow_(prev, next)protectedCreate a spacer row to go between prev and next, and set its size.
measure()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.
populateBottomRow_()protectedCreate all non-spacer elements that belong on the bottom row.
populateTopRow_()protectedCreate all non-spacer elements that belong on the top row.
recordElemPositions_(row)protectedRecord final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element.
shouldStartNewRow_(currInput, prevInput)protectedDecide whether to start a new row between the two Blockly.Inputs.