Class: RenderInfo
Defined in: packages/blockly/core/renderers/geras/info.ts:34
An object containing all sizing information needed to draw this block, customized for the geras renderer.
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.
Extends
Properties index
| Property | Description |
|---|---|
| block_ | - |
| outputConnection | - |
| isInline | - |
| isCollapsed | - |
| isInsertionMarker | - |
| RTL | - |
| height | The height of the rendered block, including child blocks. |
| widthWithChildren | The width of the rendered block, including child blocks. |
| width | The width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR. |
| statementEdge | - |
| rows | An array of Row objects containing sizing information. |
| inputRows | An array of input rows on the block. |
| topRow | - |
| bottomRow | - |
| startX | - |
| startY | - |
| constants_ | - |
| renderer_ | The block renderer in use. |
Methods index
| Method | Description |
|---|---|
| measure | Populate this object with all sizing information needed to draw the block. |
| createRows_ | Create rows of Measurable objects representing all renderable parts of the block. |
| populateTopRow_ | Create all non-spacer elements that belong on the top row. |
| shouldStartNewRow_ | Decide whether to start a new row between the two Blockly.Inputs. |
| computeBounds_ | Figure out where the right edge of the block and right edge of statement inputs should be placed. |
| addAlignmentPadding_ | 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. |
| alignStatementRow_ | Align the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places. |
| addRowSpacing_ | Add spacers between rows and set their sizes. |
| makeSpacerRow_ | Create a spacer row to go between prev and next, and set its size. |
| getSpacerRowWidth_ | Calculate the width of a spacer row. |
| recordElemPositions_ | Record final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element. |
| getMeasureableForConnection | Returns the connection measurable associated with the given connection. |
| getRenderer | Get the block renderer in use. |
| populateBottomRow_ | Create all non-spacer elements that belong on the bottom row. |
| addInput_ | Add an input element to the active row, if needed, and record the type of the input on the row. |
| addElemSpacing_ | Add horizontal spacing between and around elements within each row. |
| getInRowSpacing_ | 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_ | Calculate the height of a spacer row. |
| getElemCenterline_ | 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. |
| 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. |
| getDesiredRowWidth_ | Calculate the desired width of an input row. |
| 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. |
Constructors
Constructor
new RenderInfo(renderer, block): RenderInfo;
Defined in: packages/blockly/core/renderers/geras/info.ts:44
Parameters
| Parameter | Type | Description |
|---|---|---|
renderer | Renderer | The renderer in use. |
block | BlockSvg | The block to measure. |
Returns
RenderInfo
Overrides
Properties
block_
block_: BlockSvg;
Defined in: packages/blockly/core/renderers/common/info.ts:49
Inherited from
outputConnection
outputConnection:
| OutputConnection
| null;
Defined in: packages/blockly/core/renderers/common/info.ts:51
Inherited from
isInline
isInline: boolean;
Defined in: packages/blockly/core/renderers/common/info.ts:52
Inherited from
isCollapsed
isCollapsed: boolean;
Defined in: packages/blockly/core/renderers/common/info.ts:53
Inherited from
isInsertionMarker
isInsertionMarker: boolean;
Defined in: packages/blockly/core/renderers/common/info.ts:54
Inherited from
RTL
RTL: boolean;
Defined in: packages/blockly/core/renderers/common/info.ts:55
Inherited from
height
height: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:61
The height of the rendered block, including child blocks.
Inherited from
widthWithChildren
widthWithChildren: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:64
The width of the rendered block, including child blocks.
Inherited from
width
width: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:70
The width of the rendered block, excluding child blocks. This is the right edge of the block when rendered LTR.
Inherited from
statementEdge
statementEdge: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:71
Inherited from
rows
rows: Row[] = [];
Defined in: packages/blockly/core/renderers/common/info.ts:74
An array of Row objects containing sizing information.
Inherited from
inputRows
inputRows: InputRow[] = [];
Defined in: packages/blockly/core/renderers/common/info.ts:77
An array of input rows on the block.
Inherited from
topRow
topRow: TopRow;
Defined in: packages/blockly/core/renderers/common/info.ts:79
Inherited from
bottomRow
bottomRow: BottomRow;
Defined in: packages/blockly/core/renderers/common/info.ts:80
Inherited from
startX
startX: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:84
Inherited from
startY
startY: number = 0;
Defined in: packages/blockly/core/renderers/common/info.ts:85
Inherited from
constants_
constants_: ConstantProvider;
Defined in: packages/blockly/core/renderers/geras/info.ts:36
Overrides
renderer_
protected readonly renderer_: Renderer;
Defined in: packages/blockly/core/renderers/geras/info.ts:38
The block renderer in use.
Overrides
Methods
measure()
measure(): void;
Defined in: packages/blockly/core/renderers/common/info.ts:152
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.
Returns
void
Inherited from
createRows_()
protected createRows_(): void;
Defined in: packages/blockly/core/renderers/common/info.ts:165
Create rows of Measurable objects representing all renderable parts of the block.
Returns
void
Inherited from
populateTopRow_()
protected populateTopRow_(): void;
Defined in: packages/blockly/core/renderers/common/info.ts:217
Create all non-spacer elements that belong on the top row.
Returns
void
Inherited from
shouldStartNewRow_()
protected shouldStartNewRow_(currInput, prevInput?): boolean;
Defined in: packages/blockly/core/renderers/common/info.ts:350
Decide whether to start a new row between the two Blockly.Inputs.
Parameters
| Parameter | Type | Description |
|---|---|---|
currInput | Input | The current input. |
prevInput? | Input | The previous input. |
Returns
boolean
True if the current input should be rendered on a new row.
Inherited from
computeBounds_()
protected computeBounds_(): void;
Defined in: packages/blockly/core/renderers/common/info.ts:472
Figure out where the right edge of the block and right edge of statement inputs should be placed.
Returns
void
Inherited from
addAlignmentPadding_()
protected addAlignmentPadding_(row, missingSpace): void;
Defined in: packages/blockly/core/renderers/common/info.ts:552
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
row | Row | The row to add padding to. |
missingSpace | number | How much padding to add. |
Returns
void
Inherited from
RenderInfo.addAlignmentPadding_
alignStatementRow_()
protected alignStatementRow_(row): void;
Defined in: packages/blockly/core/renderers/common/info.ts:585
Align the elements of a statement row based on computed bounds. Unlike other types of rows, statement rows add space in multiple places.
Parameters
| Parameter | Type | Description |
|---|---|---|
row | InputRow | The statement row to resize. |
Returns
void
Inherited from
addRowSpacing_()
protected addRowSpacing_(): void;
Defined in: packages/blockly/core/renderers/common/info.ts:609
Add spacers between rows and set their sizes.
Returns
void
Inherited from
makeSpacerRow_()
protected makeSpacerRow_(prev, next): SpacerRow;
Defined in: packages/blockly/core/renderers/common/info.ts:628
Create a spacer row to go between prev and next, and set its size.
Parameters
| Parameter | Type | Description |
|---|---|---|
prev | Row | The previous row. |
next | Row | The next row. |
Returns
The newly created spacer row.
Inherited from
getSpacerRowWidth_()
protected getSpacerRowWidth_(_prev, _next): number;
Defined in: packages/blockly/core/renderers/common/info.ts:648
Calculate the width of a spacer row.
Parameters
| Parameter | Type | Description |
|---|---|---|
_prev | Row | The row before the spacer. |
_next | Row | The row after the spacer. |
Returns
number
The desired width of the spacer row between these two rows.
Inherited from
recordElemPositions_()
protected recordElemPositions_(row): void;
Defined in: packages/blockly/core/renderers/common/info.ts:700
Record final position information on elements on the given row, for use in drawing. At minimum this records xPos and centerline on each element.
Parameters
| Parameter | Type | Description |
|---|---|---|
row | Row | The row containing the elements. |
Returns
void
Inherited from
RenderInfo.recordElemPositions_
getMeasureableForConnection()
getMeasureableForConnection(conn): Connection | null;
Defined in: packages/blockly/core/renderers/common/info.ts:753
Returns the connection measurable associated with the given connection.
Parameters
| Parameter | Type |
|---|---|
conn | RenderedConnection |
Returns
Connection | null
Inherited from
RenderInfo.getMeasureableForConnection
getRenderer()
getRenderer(): Renderer;
Defined in: packages/blockly/core/renderers/geras/info.ts:54
Get the block renderer in use.
Returns
The block renderer in use.
Overrides
populateBottomRow_()
populateBottomRow_(): void;
Defined in: packages/blockly/core/renderers/geras/info.ts:58
Create all non-spacer elements that belong on the bottom row.
Returns
void
Overrides
addInput_()
addInput_(input, activeRow): void;
Defined in: packages/blockly/core/renderers/geras/info.ts:75
Add an input element to the active row, if needed, and record the type of the input on the row.
Parameters
| Parameter | Type | Description |
|---|---|---|
input | Input | The input to record information about. |
activeRow | Row | The row that is currently being populated. |
Returns
void
Overrides
addElemSpacing_()
addElemSpacing_(): void;
Defined in: packages/blockly/core/renderers/geras/info.ts:103
Add horizontal spacing between and around elements within each row.
Returns
void
Overrides
getInRowSpacing_()
getInRowSpacing_(prev, next): number;
Defined in: packages/blockly/core/renderers/geras/info.ts:146
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
prev | Measurable | null | The element before the spacer. |
next | Measurable | null | The element after the spacer. |
Returns
number
The size of the spacing between the two elements.
Overrides
getSpacerRowHeight_()
getSpacerRowHeight_(prev, next): number;
Defined in: packages/blockly/core/renderers/geras/info.ts:296
Calculate the height of a spacer row.
Parameters
| Parameter | Type | Description |
|---|---|---|
prev | Row | The row before the spacer. |
next | Row | The row after the spacer. |
Returns
number
The desired height of the spacer row between these two rows.
Overrides
RenderInfo.getSpacerRowHeight_
getElemCenterline_()
getElemCenterline_(row, elem): number;
Defined in: packages/blockly/core/renderers/geras/info.ts:323
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.
Parameters
| Parameter | Type | Description |
|---|---|---|
row | Row | The row containing the element. |
elem | Measurable | The element to place. |
Returns
number
The desired centerline of the given element, as an offset from the top left of the block.
Overrides
alignRowElements_()
alignRowElements_(): void;
Defined in: packages/blockly/core/renderers/geras/info.ts:358
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.
Returns
void
Overrides
getDesiredRowWidth_()
getDesiredRowWidth_(row): number;
Defined in: packages/blockly/core/renderers/geras/info.ts:414
Calculate the desired width of an input row.
Parameters
| Parameter | Type | Description |
|---|---|---|
row | Row | The input row. |
Returns
number
The desired width of the input row.
Overrides
RenderInfo.getDesiredRowWidth_
finalize_()
finalize_(): void;
Defined in: packages/blockly/core/renderers/geras/info.ts:424
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.
Returns
void