Stay organized with collections Save and categorize content based on your preferences.

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.


export declare class RenderInfo 


The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the RenderInfo class.


Property Modifiers Type Description
block_ BlockSvg
bottomRow BottomRow
constants_ protected ConstantProvider
height number The height of the rendered block, including child blocks.
hiddenIcons Icon[] An array of measurable objects containing hidden icons.
inputRows InputRow[] An array of input rows on the block.
isCollapsed boolean
isInline boolean
isInsertionMarker boolean
outputConnection OutputConnection | null



Renderer The block renderer in use.
rows Row[] An array of Row objects containing sizing information.
RTL boolean
startX number
startY number
statementEdge number
topRow TopRow
width number The width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR.
widthWithChildren number The width of the rendered block, including child blocks.


Method Modifiers Description
addAlignmentPadding_(row, missingSpace) protected 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.
addElemSpacing_() protected Add horizontal spacing between and around elements within each row.
addInput_(input, activeRow) protected Add an input element to the active row, if needed, and record the type of the input on the row.
addRowSpacing_() protected Add spacers between rows and set their sizes.
alignRowElements_() protected 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_(row) protected Align the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places.
computeBounds_() protected Figure out where the right edge of the block and right edge of statement inputs should be placed.
createRows_() protected Create rows of Measurable objects representing all renderable parts of the block.
finalize_() protected 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.
getDesiredRowWidth_(_row) protected Calculate the desired width of an input row.
getElemCenterline_(row, elem) protected 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.
getInRowSpacing_(prev, next) protected 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_(_prev, _next) protected Calculate the height of a spacer row.
getSpacerRowWidth_(_prev, _next) protected Calculate the width of a spacer row.
makeSpacerRow_(prev, next) protected Create a spacer row to go between prev and next, and set its size.
recordElemPositions_(row) protected Record final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element.
shouldStartNewRow_(input, lastInput) protected Decide whether to start a new row between the two Blockly.Inputs.