Blockly. blockRendering
The top level namespace for block rendering.
Classes
BottomRow
An object containing information about what elements are in the bottom row of a block as well as spacing information for the top row. Elements in a bottom row can consist of corners, spacers and next connections.
Connection
The base class to represent a connection and the space that it takes up on the block.
ConstantProvider
An object that provides constants for rendering blocks.
Debug
An object that renders rectangles and dots for debugging rendering code.
Drawer
An object that draws a block based on the given rendering information.
ExternalValueInput
An object containing information about the space an external value input takes up during rendering
Field
An object containing information about the space a field takes up during rendering
Hat
An object containing information about the space a hat takes up during rendering.
Icon
An object containing information about the space an icon takes up during rendering
InlineInput
An object containing information about the space an inline input takes up during rendering
InputConnection
The base class to represent an input that takes up space on a block during rendering
InputRow
An object containing information about a row that holds one or more inputs.
InRowSpacer
An object containing information about a spacer between two elements on a row.
JaggedEdge
An object containing information about the jagged edge of a collapsed block takes up during rendering
MarkerSvg
Class for a marker.
Measurable
The base class to represent a part of a block that takes up space during rendering. The constructor for each non-spacer Measurable records the size of the block element (e.g. field, statement input).
NextConnection
An object containing information about the space a next connection takes up during rendering.
OutputConnection
An object containing information about the space an output connection takes up during rendering.
PathObject
An object that handles creating and setting each of the SVG elements used by the renderer.
PreviousConnection
An object containing information about the space a previous connection takes up during rendering.
Renderer
The base class for a block renderer.
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.
RoundCorner
An object containing information about the space a rounded corner takes up during rendering.
Row
An object representing a single row on a rendered block and all of its subcomponents.
SpacerRow
An object containing information about a spacer between two rows.
SquareCorner
An object containing information about the space a square corner takes up during rendering.
StatementInput
An object containing information about the space a statement input takes up during rendering
TopRow
An object containing information about what elements are in the top row of a block as well as sizing information for the top row. Elements in a top row can consist of corners, hats, spacers, and previous connections. After this constructor is called, the row will contain all non-spacer elements it needs.
Interface
IPathObject
Enumeration
Types
number
Types of rendering elements.
Value |
|
---|---|
NONE |
|
FIELD |
|
HAT |
|
ICON |
|
SPACER |
|
BETWEEN_ROW_SPACER |
|
IN_ROW_SPACER |
|
EXTERNAL_VALUE_INPUT |
|
INPUT |
|
INLINE_INPUT |
|
STATEMENT_INPUT |
|
CONNECTION |
|
PREVIOUS_CONNECTION |
|
NEXT_CONNECTION |
|
OUTPUT_CONNECTION |
|
CORNER |
|
LEFT_SQUARE_CORNER |
|
LEFT_ROUND_CORNER |
|
RIGHT_SQUARE_CORNER |
|
RIGHT_ROUND_CORNER |
|
JAGGED_EDGE |
|
ROW |
|
TOP_ROW |
|
BOTTOM_ROW |
|
INPUT_ROW |
Properties
Types
number
Types of rendering elements.
Value |
|
---|---|
NONE |
|
FIELD |
|
HAT |
|
ICON |
|
SPACER |
|
BETWEEN_ROW_SPACER |
|
IN_ROW_SPACER |
|
EXTERNAL_VALUE_INPUT |
|
INPUT |
|
INLINE_INPUT |
|
STATEMENT_INPUT |
|
CONNECTION |
|
PREVIOUS_CONNECTION |
|
NEXT_CONNECTION |
|
OUTPUT_CONNECTION |
|
CORNER |
|
LEFT_SQUARE_CORNER |
|
LEFT_ROUND_CORNER |
|
RIGHT_SQUARE_CORNER |
|
RIGHT_ROUND_CORNER |
|
JAGGED_EDGE |
|
ROW |
|
TOP_ROW |
|
BOTTOM_ROW |
|
INPUT_ROW |
useDebugger
boolean
Whether or not the debugger is turned on.
Methods
init
init(name, theme, opt_rendererOverrides) returns Blockly.blockRendering.Renderer
Initialize anything needed for rendering (constants, etc).
Parameter |
|
---|---|
name |
string Name of the renderer to initialize. Value must not be null. |
theme |
The workspace theme object. Value must not be null. |
opt_rendererOverrides |
Optional Object Rendering constant overrides. |
- Returns
-
non-null Blockly.blockRendering.Renderer
The new instance of a renderer. Already initialized.
register
register(name, rendererClass)
Registers a new renderer.
Parameter |
|
---|---|
name |
string The name of the renderer. |
rendererClass |
function() The new renderer class to register. Value must not be null. |
- Throws
-
Error
if a renderer with the same name has already been registered.
startDebugger
startDebugger()
Turn on the blocks debugger.
stopDebugger
stopDebugger()
Turn off the blocks debugger.
unregister
unregister(name)
Unregisters the renderer registered with the given name.
Parameter |
|
---|---|
name |
string The name of the renderer. |