Stay organized with collections
Save and categorize content based on your preferences.
blockly > blockRendering > Renderer
blockRendering.Renderer class
The base class for a block renderer.
Signature:
export declare class Renderer implements IRegistrable
Implements: IRegistrable
Constructors
Constructor |
Modifiers |
Description |
(constructor)(name) |
|
Constructs a new instance of the Renderer class |
Properties
Property |
Modifiers |
Type |
Description |
constants_ |
protected |
ConstantProvider |
The renderer's constant provider. |
name |
protected |
string |
|
overrides |
protected |
object | null |
Rendering constant overrides, passed in through options. |
Methods
Method |
Modifiers |
Description |
dispose() |
|
Dispose of this renderer. Delete all DOM elements that this renderer and its constants created. |
getClassName() |
|
Gets the class name that identifies this renderer. |
getConstants() |
|
Get the current renderer's constant provider. We assume that when this is called, the renderer has already been initialized. |
init(theme, opt_rendererOverrides) |
|
Initialize the renderer. |
makeConstants_() |
protected |
Create a new instance of the renderer's constant provider. |
makeDrawer_(block, info) |
protected |
Create a new instance of the renderer's drawer. |
makePathObject(root, style) |
|
Create a new instance of a renderer path object. |
makeRenderInfo_(block) |
protected |
Create a new instance of the renderer's render info object. |
orphanCanConnectAtEnd(topBlock, orphanBlock, localType) |
protected |
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. |
refreshDom(svg, theme, injectionDivIfIsParent) |
|
Refresh the renderer after a theme change. |
shouldHighlightConnection(_conn) |
|
Determine whether or not to highlight a connection. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eblockRendering.Renderer\u003c/code\u003e class serves as the foundation for rendering blocks in Blockly, managing their visual representation and interactions.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods for initialization, disposal, refreshing the display based on themes, and creating supporting components like drawers and render info objects.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eblockRendering.Renderer\u003c/code\u003e provides functionalities for handling connection previews and highlighting, allowing for interactive block connections.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can extend this base class to create custom renderers with unique block styles and behaviors using properties such as \u003ccode\u003econstants_\u003c/code\u003e and \u003ccode\u003eoverrides\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [blockRendering](./blockly.blockrendering_namespace.md) \\\u003e [Renderer](./blockly.blockrendering_namespace.renderer_class.md)\n\nblockRendering.Renderer class\n-----------------------------\n\nThe base class for a block renderer.\n\n**Signature:** \n\n export declare class Renderer implements IRegistrable \n\n**Implements:** [IRegistrable](./blockly.iregistrable_interface.md)\n\nConstructors\n------------\n\n| Constructor | Modifiers | Description |\n|---------------------------------------------------------------------------------------------------------|-----------|---------------------------------------------------|\n| [(constructor)(name)](./blockly.blockrendering_namespace.renderer_class._constructor__1_constructor.md) | | Constructs a new instance of the `Renderer` class |\n\nProperties\n----------\n\n| Property | Modifiers | Type | Description |\n|----------------------------------------------------------------------------------------|-------------|----------------------------------------------------------------------------------|----------------------------------------------------------|\n| [constants_](./blockly.blockrendering_namespace.renderer_class.constants__property.md) | `protected` | [ConstantProvider](./blockly.blockrendering_namespace.constantprovider_class.md) | The renderer's constant provider. |\n| [name](./blockly.blockrendering_namespace.renderer_class.name_property.md) | `protected` | string | |\n| [overrides](./blockly.blockrendering_namespace.renderer_class.overrides_property.md) | `protected` | object \\| null | Rendering constant overrides, passed in through options. |\n\nMethods\n-------\n\n| Method | Modifiers | Description |\n|------------------------------------------------------------------------------------------------------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [dispose()](./blockly.blockrendering_namespace.renderer_class.dispose_1_method.md) | | Dispose of this renderer. Delete all DOM elements that this renderer and its constants created. |\n| [getClassName()](./blockly.blockrendering_namespace.renderer_class.getclassname_1_method.md) | | Gets the class name that identifies this renderer. |\n| [getConstants()](./blockly.blockrendering_namespace.renderer_class.getconstants_1_method.md) | | Get the current renderer's constant provider. We assume that when this is called, the renderer has already been initialized. |\n| [init(theme, opt_rendererOverrides)](./blockly.blockrendering_namespace.renderer_class.init_1_method.md) | | Initialize the renderer. |\n| [makeConstants_()](./blockly.blockrendering_namespace.renderer_class.makeconstants__1_method.md) | `protected` | Create a new instance of the renderer's constant provider. |\n| [makeDrawer_(block, info)](./blockly.blockrendering_namespace.renderer_class.makedrawer__1_method.md) | `protected` | Create a new instance of the renderer's drawer. |\n| [makePathObject(root, style)](./blockly.blockrendering_namespace.renderer_class.makepathobject_1_method.md) | | Create a new instance of a renderer path object. |\n| [makeRenderInfo_(block)](./blockly.blockrendering_namespace.renderer_class.makerenderinfo__1_method.md) | `protected` | Create a new instance of the renderer's render info object. |\n| [orphanCanConnectAtEnd(topBlock, orphanBlock, localType)](./blockly.blockrendering_namespace.renderer_class.orphancanconnectatend_1_method.md) | `protected` | 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. |\n| [refreshDom(svg, theme, injectionDivIfIsParent)](./blockly.blockrendering_namespace.renderer_class.refreshdom_1_method.md) | | Refresh the renderer after a theme change. |\n| [shouldHighlightConnection(_conn)](./blockly.blockrendering_namespace.renderer_class.shouldhighlightconnection_1_method.md) | | Determine whether or not to highlight a connection. |"]]