Class: Renderer
Defined in: packages/blockly/core/renderers/geras/renderer.ts:28
The geras renderer. This renderer was designed to be backwards compatible with pre-2019 Blockly. Newer projects that are not constrained by backwards compatibility should use thrasos, which is a more modern take on this renderer.
Geras is the ancient Greek spirit of old age.
Extends
Properties index
| Property | Description |
|---|---|
| constants_ | The renderer's constant provider. |
| name | - |
| overrides | Rendering constant overrides, passed in through options. |
Methods index
| Method | Description |
|---|---|
| getClassName | Gets the class name that identifies this renderer. |
| dispose | Dispose of this renderer. Delete all DOM elements that this renderer and its constants created. |
| getConstants | Get the current renderer's constant provider. We assume that when this is called, the renderer has already been initialized. |
| shouldHighlightConnection | Determine whether or not to highlight a connection. |
| orphanCanConnectAtEnd | Checks if an orphaned block can connect to the "end" of the topBlock's block-clump. If the clump is a row the end is the last input. If the clump is a stack, the end is the last next connection. If the clump is neither, then this returns false. |
| init | Initialize the renderer. Geras has a highlight provider in addition to the normal constant provider. |
| refreshDom | Refresh the renderer after a theme change. |
| makeConstants_ | Create a new instance of the renderer's constant provider. |
| makeRenderInfo_ | Create a new instance of the renderer's render info object. |
| makeDrawer_ | Create a new instance of the renderer's drawer. |
| makePathObject | Create a new instance of a renderer path object. |
| makeHighlightConstants_ | Create a new instance of the renderer's highlight constant provider. |
| getHighlightConstants | Get the renderer's highlight constant provider. We assume that when this is called, the renderer has already been initialized. |
Constructors
Constructor
new Renderer(name): Renderer;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:35
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The renderer name. |
Returns
Renderer
Overrides
Properties
constants_
protected constants_: ConstantProvider;
Defined in: packages/blockly/core/renderers/common/renderer.ts:27
The renderer's constant provider.
Inherited from
name
protected name: string;
Defined in: packages/blockly/core/renderers/common/renderer.ts:29
Inherited from
overrides
protected overrides: object | null = null;
Defined in: packages/blockly/core/renderers/common/renderer.ts:34
Rendering constant overrides, passed in through options.
Inherited from
Methods
getClassName()
getClassName(): string;
Defined in: packages/blockly/core/renderers/common/renderer.ts:48
Gets the class name that identifies this renderer.
Returns
string
The CSS class name.
Inherited from
dispose()
dispose(): void;
Defined in: packages/blockly/core/renderers/common/renderer.ts:130
Dispose of this renderer. Delete all DOM elements that this renderer and its constants created.
Returns
void
Inherited from
getConstants()
getConstants(): ConstantProvider;
Defined in: packages/blockly/core/renderers/common/renderer.ts:184
Get the current renderer's constant provider. We assume that when this is called, the renderer has already been initialized.
Returns
The constant provider.
Inherited from
shouldHighlightConnection()
shouldHighlightConnection(connection): boolean;
Defined in: packages/blockly/core/renderers/common/renderer.ts:194
Determine whether or not to highlight a connection.
Parameters
| Parameter | Type | Description |
|---|---|---|
connection | RenderedConnection | The connection to determine whether or not to highlight. |
Returns
boolean
True if we should highlight the connection.
Inherited from
Renderer.shouldHighlightConnection
orphanCanConnectAtEnd()
protected orphanCanConnectAtEnd(
topBlock,
orphanBlock,
localType
): boolean;
Defined in: packages/blockly/core/renderers/common/renderer.ts:210
Checks if an orphaned block can connect to the "end" of the topBlock's block-clump. If the clump is a row the end is the last input. If the clump is a stack, the end is the last next connection. If the clump is neither, then this returns false.
Parameters
| Parameter | Type | Description |
|---|---|---|
topBlock | BlockSvg | The top block of the block clump we want to try and connect to. |
orphanBlock | BlockSvg | The orphan block that wants to find a home. |
localType | number | The type of the connection being dragged. |
Returns
boolean
Whether there is a home for the orphan or not.
Inherited from
Renderer.orphanCanConnectAtEnd
init()
init(theme, opt_rendererOverrides?): void;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:43
Initialize the renderer. Geras has a highlight provider in addition to the normal constant provider.
Parameters
| Parameter | Type |
|---|---|
theme | Theme |
opt_rendererOverrides? | { [rendererConstant: string]: any; } |
Returns
void
Overrides
refreshDom()
refreshDom(
svg,
theme,
injectionDiv
): void;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:52
Refresh the renderer after a theme change.
Parameters
| Parameter | Type | Description |
|---|---|---|
svg | SVGElement | The root of the workspace's SVG. |
theme | Theme | The workspace theme object. |
injectionDiv | HTMLElement | The div containing the parent workspace and all related workspaces and block containers, if this renderer is for the parent workspace. CSS variables representing SVG patterns will be scoped to this container. Child workspaces should not override the CSS variables created by the parent and thus do not need access to the injection div. |
Returns
void
Overrides
makeConstants_()
makeConstants_(): ConstantProvider;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:61
Create a new instance of the renderer's constant provider.
Returns
The constant provider.
Overrides
makeRenderInfo_()
protected makeRenderInfo_(block): RenderInfo;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:71
Create a new instance of the renderer's render info object.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | BlockSvg | The block to measure. |
Returns
The render info object.
Overrides
makeDrawer_()
protected makeDrawer_(block, info): Drawer;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:83
Create a new instance of the renderer's drawer.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | BlockSvg | The block to render. |
info | RenderInfo | An object containing all information needed to render this block. |
Returns
The drawer.
Overrides
makePathObject()
makePathObject(root, style): PathObject;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:97
Create a new instance of a renderer path object.
Parameters
| Parameter | Type | Description |
|---|---|---|
root | SVGElement | The root SVG element. |
style | BlockStyle | The style object to use for colouring. |
Returns
The renderer path object.
Overrides
makeHighlightConstants_()
protected makeHighlightConstants_(): HighlightConstantProvider;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:106
Create a new instance of the renderer's highlight constant provider.
Returns
The highlight constant provider.
getHighlightConstants()
getHighlightConstants(): HighlightConstantProvider;
Defined in: packages/blockly/core/renderers/geras/renderer.ts:116
Get the renderer's highlight constant provider. We assume that when this is called, the renderer has already been initialized.
Returns
The highlight constant provider.