Blockly.geras. RenderInfo
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.
Constructor
RenderInfo
new RenderInfo(renderer, block)
Parameter |
|
---|---|
renderer |
The renderer in use. Value must not be null. |
block |
The block to measure. Value must not be null. |
Properties
bottomRow
unknown
An object with rendering information about the bottom row of the block.
- Inherited from
- Blockly.blockRendering.RenderInfo#bottomRow
constants_
non-null Blockly.geras.ConstantProvider
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.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.geras.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.blockRendering.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_
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. Value must not be null. |
missingSpace |
How much padding to add. |
- Inherited from
- Blockly.blockRendering.RenderInfo#addAlignmentPadding_
addElemSpacing_
addElemSpacing_()
Add horizontal spacing between and around elements within each row.
- Inherited from
- Blockly.geras.RenderInfo#addElemSpacing_
addInput_
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.geras.RenderInfo#addInput_
addRowSpacing_
addRowSpacing_()
Add spacers between rows and set their sizes.
- Inherited from
- Blockly.blockRendering.RenderInfo#addRowSpacing_
alignRowElements_
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.geras.RenderInfo#alignRowElements_
alignStatementRow_
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_
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_
createRows_()
Create rows of Measurable objects representing all renderable parts of the block.
- Inherited from
- Blockly.blockRendering.RenderInfo#createRows_
finalize_
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.geras.RenderInfo#finalize_
getDesiredRowWidth_
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.geras.RenderInfo#getDesiredRowWidth_
- Returns
-
The desired width of the input row.
getElemCenterline_
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.geras.RenderInfo#getElemCenterline_
- Returns
-
The desired centerline of the given element, as an offset from the top left of the block.
getInRowSpacing_
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.geras.RenderInfo#getInRowSpacing_
- Returns
-
The size of the spacing between the two elements.
getRenderer
getRenderer() returns Blockly.geras.Renderer
Get the block renderer in use.
- Returns
-
non-null Blockly.geras.Renderer
The block renderer in use.
getSpacerRowHeight_
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.geras.RenderInfo#getSpacerRowHeight_
- Returns
-
The desired height of the spacer row between these two rows.
getSpacerRowWidth_
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_
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
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_
populateBottomRow_()
Create all non-spacer elements that belong on the bottom row.
- Inherited from
- Blockly.geras.RenderInfo#populateBottomRow_
populateTopRow_
populateTopRow_()
Create all non-spacer elements that belong on the top row.
- Inherited from
- Blockly.blockRendering.RenderInfo#populateTopRow_
recordElemPositions_
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_
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.