Skip to main content

Class: PathObject

Defined in: packages/blockly/core/renderers/geras/path_object.ts:21

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

Extends

Properties index

PropertyDescription
svgRoot-
svgPathThe primary path of the block.
styleThe primary path of the block.
svgPathDark-
svgPathLight-
colourDarkThe colour of the dark path on the block in '#RRGGBB' format.
constantsThe renderer's constants.

Methods index

MethodDescription
setClass_Add or remove the given CSS class on the path object's root SVG element.
updateSelectedAdd or remove styling showing that a block is selected.
updateDraggingDeleteAdd or remove styling showing that a block is dragged over a delete area.
updateInsertionMarkerAdd or remove styling showing that a block is an insertion marker.
updateMovableAdd or remove styling showing that a block is movable.
updateReplacingAdd or remove styling indicating that a block will be bumped out and replaced by another block that is mid-move.
addConnectionHighlightAdds the given path as a connection highlight for the given connection.
removeConnectionHighlightRemoves any highlight associated with the given connection, if it exists.
setPathSet the path generated by the renderer onto the respective SVG element.
setHighlightPathSet the highlight path generated by the renderer onto the SVG element.
flipRTLFlip the SVG paths in RTL.
applyColourApply the stored colours to the block's path, taking into account whether the paths belong to a shadow block.
setStyleSet the style.
updateHighlightedSet whether the block shows a highlight or not. Block highlighting is often used to visually mark blocks currently being executed.
updateShadow_Updates the look of the block to reflect a shadow state.
updateDisabled_Updates the look of the block to reflect a disabled state.

Constructors

Constructor

new PathObject(
root,
style,
constants
): PathObject;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:35

Parameters

ParameterTypeDescription
rootSVGElementThe root SVG element.
styleBlockStyleThe style object to use for colouring.
constantsConstantProviderThe renderer's constants.

Returns

PathObject

Overrides

PathObject.constructor

Properties

svgRoot

svgRoot: SVGElement;

Defined in: packages/blockly/core/renderers/common/path_object.ts:23

Inherited from

PathObject.svgRoot


svgPath

svgPath: SVGElement;

Defined in: packages/blockly/core/renderers/common/path_object.ts:24

The primary path of the block.

Inherited from

PathObject.svgPath


style

style: BlockStyle;

Defined in: packages/blockly/core/renderers/common/path_object.ts:27

The primary path of the block.

Inherited from

PathObject.style


svgPathDark

svgPathDark: SVGElement;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:22


svgPathLight

svgPathLight: SVGElement;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:23


colourDark

colourDark: string = '#000000';

Defined in: packages/blockly/core/renderers/geras/path_object.ts:28

The colour of the dark path on the block in '#RRGGBB' format.


constants

constants: ConstantProvider;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:38

The renderer's constants.

Inherited from

PathObject.constants

Methods

setClass_()

protected setClass_(className, add): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:106

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

Parameters

ParameterTypeDescription
classNamestringThe name of the class to add or remove
addbooleanTrue if the class should be added. False if it should be removed.

Returns

void

Inherited from

PathObject.setClass_


updateSelected()

updateSelected(enable): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:162

Add or remove styling showing that a block is selected.

Parameters

ParameterTypeDescription
enablebooleanTrue if selection is enabled, false otherwise.

Returns

void

Inherited from

PathObject.updateSelected


updateDraggingDelete()

updateDraggingDelete(enable): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:172

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

Parameters

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

Returns

void

Inherited from

PathObject.updateDraggingDelete


updateInsertionMarker()

updateInsertionMarker(enable): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:181

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

Parameters

ParameterTypeDescription
enablebooleanTrue if the block is an insertion marker, false otherwise.

Returns

void

Inherited from

PathObject.updateInsertionMarker


updateMovable()

updateMovable(enable): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:190

Add or remove styling showing that a block is movable.

Parameters

ParameterTypeDescription
enablebooleanTrue if the block is movable, false otherwise.

Returns

void

Inherited from

PathObject.updateMovable


updateReplacing()

updateReplacing(replacing): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:201

Add or remove styling indicating that a block will be bumped out and replaced by another block that is mid-move.

Parameters

ParameterTypeDescription
replacingbooleanTrue if the block is at risk of being replaced, false otherwise.

Returns

void

Inherited from

PathObject.updateReplacing


addConnectionHighlight()

addConnectionHighlight(
connection,
connectionPath,
offset,
rtl
): SVGElement;

Defined in: packages/blockly/core/renderers/common/path_object.ts:206

Adds the given path as a connection highlight for the given connection.

Parameters

ParameterType
connectionRenderedConnection
connectionPathstring
offsetCoordinate
rtlboolean

Returns

SVGElement

Inherited from

PathObject.addConnectionHighlight


removeConnectionHighlight()

removeConnectionHighlight(connection): void;

Defined in: packages/blockly/core/renderers/common/path_object.ts:241

Removes any highlight associated with the given connection, if it exists.

Parameters

ParameterType
connectionRenderedConnection

Returns

void

Inherited from

PathObject.removeConnectionHighlight


setPath()

setPath(mainPath): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:60

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

Parameters

ParameterTypeDescription
mainPathstringThe path.

Returns

void

Overrides

PathObject.setPath


setHighlightPath()

setHighlightPath(highlightPath): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:70

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

Parameters

ParameterTypeDescription
highlightPathstringThe highlight path.

Returns

void


flipRTL()

flipRTL(): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:74

Flip the SVG paths in RTL.

Returns

void

Overrides

PathObject.flipRTL


applyColour()

applyColour(block): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:81

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

Parameters

ParameterTypeDescription
blockBlockSvgThe source block.

Returns

void

Overrides

PathObject.applyColour


setStyle()

setStyle(blockStyle): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:92

Set the style.

Parameters

ParameterTypeDescription
blockStyleBlockStyleThe block style to use.

Returns

void

Overrides

PathObject.setStyle


updateHighlighted()

updateHighlighted(highlighted): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:98

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

Parameters

ParameterTypeDescription
highlightedbooleanTrue if highlighted.

Returns

void

Overrides

PathObject.updateHighlighted


updateShadow_()

updateShadow_(shadow): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:107

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

Parameters

ParameterTypeDescription
shadowbooleanTrue if the block is a shadow block.

Returns

void

Overrides

PathObject.updateShadow_


updateDisabled_()

updateDisabled_(disabled): void;

Defined in: packages/blockly/core/renderers/geras/path_object.ts:115

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

Parameters

ParameterTypeDescription
disabledbooleanTrue if disabled.

Returns

void

Overrides

PathObject.updateDisabled_