Class: Renderer

Constructor

Renderer

new Renderer(name)

The base class for a block renderer.

Parameter

name

string

The renderer name.

Properties

constants_

non-null Blockly.blockRendering.ConstantProvider

constants_

non-null Blockly.blockRendering.ConstantProvider

name

package

string

The renderer name.

Methods

getConstants

package

getConstants() returns Blockly.blockRendering.ConstantProvider

Get the current renderer's constant provider. We assume that when this is called, the renderer has already been initialized.

Returns

non-null Blockly.blockRendering.ConstantProvider The constant provider.

init

package

init()

Initialize the renderer.

makeConstants_

protected

makeConstants_() returns Blockly.blockRendering.ConstantProvider

Create a new instance of the renderer's constant provider.

Returns

non-null Blockly.blockRendering.ConstantProvider The constant provider.

makeDebugger_

protected

makeDebugger_() returns Blockly.blockRendering.Debug

Create a new instance of the renderer's debugger.

Returns

non-null Blockly.blockRendering.Debug The renderer debugger.

makeDrawer_

protected

makeDrawer_(block, info) returns Blockly.blockRendering.Drawer

Create a new instance of the renderer's drawer.

Parameter

block

Blockly.BlockSvg

The block to render.

Value must not be null.

info

Blockly.blockRendering.RenderInfo

An object containing all information needed to render this block.

Value must not be null.

Returns

non-null Blockly.blockRendering.Drawer The drawer.

makeMarkerDrawer

package

makeMarkerDrawer(workspace, marker) returns Blockly.blockRendering.MarkerSvg

Create a new instance of the renderer's marker drawer.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace the marker belongs to.

Value must not be null.

marker

Blockly.Marker

The marker.

Value must not be null.

Returns

non-null Blockly.blockRendering.MarkerSvg The object in charge of drawing the marker.

makePathObject

package

makePathObject(root, style) returns Blockly.blockRendering.IPathObject

Create a new instance of a renderer path object.

Parameter

root

SVGElement

The root SVG element.

Value must not be null.

style

Blockly.Theme.BlockStyle

The style object to use for colouring.

Value must not be null.

Returns

non-null Blockly.blockRendering.IPathObject The renderer path object.

makeRenderInfo_

protected

makeRenderInfo_(block) returns Blockly.blockRendering.RenderInfo

Create a new instance of the renderer's render info object.

Parameter

block

Blockly.BlockSvg

The block to measure.

Value must not be null.

Returns

non-null Blockly.blockRendering.RenderInfo The render info object.

render

package

render(block)

Render the block.

Parameter

block

Blockly.BlockSvg

The block to render.

Value must not be null.

shouldHighlightConnection

package

shouldHighlightConnection(_conn) returns boolean

Determine whether or not to highlight a connection.

Parameter

_conn

Blockly.Connection

The connection to determine whether or not to highlight.

Returns

boolean True if we should highlight the connection.

shouldInsertDraggedBlock

package

shouldInsertDraggedBlock(block, conn) returns boolean

Determine whether or not to insert a dragged block into a stack.

Parameter

block

Blockly.Block

The target block.

Value must not be null.

conn

Blockly.Connection

The closest connection.

Value must not be null.

Returns

boolean True if we should insert the dragged block into the stack.