Class: PathObject

Constructor

PathObject

new PathObject(root, style, constants)

An object that handles creating and setting each of the SVG elements used by the renderer.

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.

constants

Blockly.blockRendering.ConstantProvider

The renderer's constants.

Value must not be null.

Implements
Blockly.blockRendering.IPathObject

Properties

constants

package

non-null Blockly.blockRendering.ConstantProvider

The renderer's constant provider.

cursorSvg

package

SVGElement

Holds the cursors svg element when the cursor is attached to the block. This is null if there is no cursor on the block.

markerSvg

package

SVGElement

Holds the markers svg element when the marker is attached to the block. This is null if there is no marker on the block.

style

package

non-null Blockly.Theme.BlockStyle

The style object to use when colouring block paths.

svgPath

package

SVGElement

The primary path of the block.

svgRoot

non-null Element

svgRoot

non-null Element

Methods

applyColour

package

applyColour(block)

Apply the stored colours to the block's path, taking into account whether the paths belong to a shadow block.

Parameter

block

Blockly.Block

The source block.

Value must not be null.

Implements
Blockly.blockRendering.IPathObject#applyColour

flipRTL

package

flipRTL()

Flip the SVG paths in RTL.

Implements
Blockly.blockRendering.IPathObject#flipRTL

setClass_

protected

setClass_(className, add)

Add or remove the given CSS class on the path object's root SVG element.

Parameter

className

string

The name of the class to add or remove

add

boolean

True if the class should be added. False if it should be removed.

setCursorSvg

package

setCursorSvg(cursorSvg)

Add the cursor svg to this block's svg group.

Parameter

cursorSvg

SVGElement

The svg root of the cursor to be added to the block svg group.

Implements
Blockly.blockRendering.IPathObject#setCursorSvg

setMarkerSvg

package

setMarkerSvg(markerSvg)

Add the marker svg to this block's svg group.

Parameter

markerSvg

SVGElement

The svg root of the marker to be added to the block svg group.

Implements
Blockly.blockRendering.IPathObject#setMarkerSvg

setPath

package

setPath(pathString)

Set the path generated by the renderer onto the respective SVG element.

Parameter

pathString

string

The path.

Implements
Blockly.blockRendering.IPathObject#setPath

setStyle

package

setStyle(blockStyle)

Set the style.

Parameter

blockStyle

Blockly.Theme.BlockStyle

The block style to use.

Value must not be null.

Implements
Blockly.blockRendering.IPathObject#setStyle

updateDisabled_

protected

updateDisabled_(disabled)

Updates the look of the block to reflect a disabled state.

Parameter

disabled

boolean

True if disabled.

updateDraggingDelete

package

updateDraggingDelete(enable)

Add or remove styling showing that a block is dragged over a delete area.

Parameter

enable

boolean

True if the block is being dragged over a delete area, false otherwise.

Implements
Blockly.blockRendering.IPathObject#updateDraggingDelete

updateHighlighted

package

updateHighlighted(enable)

Set whether the block shows a highlight or not. Block highlighting is often used to visually mark blocks currently being executed.

Parameter

enable

boolean

True if highlighted.

Implements
Blockly.blockRendering.IPathObject#updateHighlighted

updateInsertionMarker

package

updateInsertionMarker(enable)

Add or remove styling showing that a block is an insertion marker.

Parameter

enable

boolean

True if the block is an insertion marker, false otherwise.

Implements
Blockly.blockRendering.IPathObject#updateInsertionMarker

updateMovable

package

updateMovable(enable)

Add or remove styling showing that a block is movable.

Parameter

enable

boolean

True if the block is movable, false otherwise.

Implements
Blockly.blockRendering.IPathObject#updateMovable

updateReplacementFade

package

updateReplacementFade(enable)

Add or remove styling that shows that if the dragging block is dropped, this block will be replaced. If a shadow block, it will disappear. Otherwise it will bump.

Parameter

enable

boolean

True if styling should be added.

Implements
Blockly.blockRendering.IPathObject#updateReplacementFade

updateSelected

package

updateSelected(enable)

Add or remove styling showing that a block is selected.

Parameter

enable

boolean

True if selection is enabled, false otherwise.

Implements
Blockly.blockRendering.IPathObject#updateSelected

updateShadow_

protected

updateShadow_(shadow)

Updates the look of the block to reflect a shadow state.

Parameter

shadow

boolean

True if the block is a shadow block.

updateShapeForInputHighlight

package

updateShapeForInputHighlight(_conn, _enable)

Add or remove styling that shows that if the dragging block is dropped, this block will be connected to the input.

Parameter

_conn

Blockly.Connection

The connection on the input to highlight.

_enable

boolean

True if styling should be added.