Blockly.blockRendering. 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 |
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
non-null Blockly.blockRendering.ConstantProvider
The renderer's constant provider.
- Implements
- Blockly.blockRendering.IPathObject#constants
cursorSvg
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.
- Implements
- Blockly.blockRendering.IPathObject#cursorSvg
markerSvg
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.
- Implements
- Blockly.blockRendering.IPathObject#markerSvg
style
non-null Blockly.Theme.BlockStyle
The style object to use when colouring block paths.
- Implements
- Blockly.blockRendering.IPathObject#style
svgPath
non-null SVGElement
The primary path of the block.
- Implements
- Blockly.blockRendering.IPathObject#svgPath
svgRoot
non-null Element
svgRoot
non-null Element
Methods
applyColour
applyColour(block)
Apply the stored colours to the block's path, taking into account whether the paths belong to a shadow block.
Parameter |
|
---|---|
block |
The source block. Value must not be null. |
flipRTL
flipRTL()
Flip the SVG paths in RTL.
- Implements
- Blockly.blockRendering.IPathObject#flipRTL
setClass_
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
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. |
setMarkerSvg
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. |
setPath
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
setStyle(blockStyle)
Set the style.
Parameter |
|
---|---|
blockStyle |
The block style to use. Value must not be null. |
- Implements
- Blockly.blockRendering.IPathObject#setStyle
updateDisabled_
updateDisabled_(disabled)
Updates the look of the block to reflect a disabled state.
Parameter |
|
---|---|
disabled |
boolean True if disabled. |
updateDraggingDelete
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. |
updateHighlighted
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. |
updateInsertionMarker
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. |
updateMovable
updateMovable(enable)
Add or remove styling showing that a block is movable.
Parameter |
|
---|---|
enable |
boolean True if the block is movable, false otherwise. |
updateReplacementFade
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. |
updateSelected
updateSelected(enable)
Add or remove styling showing that a block is selected.
Parameter |
|
---|---|
enable |
boolean True if selection is enabled, false otherwise. |
updateShadow_
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
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 |
The connection on the input to highlight. |
_enable |
boolean True if styling should be added. |