blockly > icons > Icon

icons.Icon class

The abstract icon class. Icons are visual elements that live in the top-start corner of the block. Usually they provide more "meta" information about a block (such as warnings or comments) as opposed to fields, which provide "actual" information, related to how a block functions.

Signature:

export declare abstract class Icon implements IIcon 

Implements: IIcon

Constructors

Constructor Modifiers Description
(constructor)(sourceBlock) Constructs a new instance of the Icon class

Properties

Property Modifiers Type Description
offsetInBlock protected Coordinate The position of this icon relative to its blocks top-start, in workspace units.
sourceBlock protected Block
svgRoot protected SVGGElement | null The root svg element visually representing this icon.
tooltip protected tooltip.TipInfo The tooltip for this icon.
workspaceLocation protected Coordinate The position of this icon in workspace coordinates.

Methods

Method Modifiers Description
applyColour()
dispose()
getSize()
getTooltip() Returns the tooltip for this icon.
getType()
getWeight()
hideForInsertionMarker()
initView(pointerdownListener)
isClickableInFlyout(autoClosingFlyout) Check whether the icon should be clickable while the block is in a flyout. The default is that icons are clickable in all flyouts (auto-closing or not). Subclasses may override this function to change this behavior.
isShownWhenCollapsed()
onClick()
onLocationChange(blockOrigin)
setOffsetInBlock(offset)
setTooltip(tip) Sets the tooltip for this icon to the given value. Null to show the tooltip of the block.
setVisible(visibility) Sets the visibility of the icon's bubble if one exists.
updateCollapsed()
updateEditable()