blockly > Icon

Icon class

Class for an icon.


export declare abstract class Icon 


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


Property Modifiers Type Description
block_ protected BlockSvg | null
bubble_ protected Bubble | null Bubble UI (if visible).
collapseHidden boolean Whether this icon gets hidden when the block is collapsed.
iconGroup_ SVGGElement | null The icon SVG group.
iconXY_ protected Coordinate | null Absolute coordinate of icon's center.
SIZE readonly (not declared) Height and width of icons.


Method Modifiers Description
applyColour() Change the colour of the associated bubble to match its block.
computeIconLocation() Notification that the icon has moved, but we don't really know where. Recompute the icon's location from scratch.
createIcon() Create the icon on the block.
dispose() Dispose of this icon.
drawIcon_(_group) protected Draw the icon.
getBlock() protected
getCorrectedSize() Get the size of the icon as used for rendering. This differs from the actual size of the icon, because it bulges slightly out of its row rather than increasing the height of its row.
getIconLocation() Returns the center of the block's icon relative to the surface.
iconClick_(e) protected Clicking on the icon toggles if the bubble is visible.
isVisible() Is the associated bubble visible?
setIconLocation(xy) Notification that the icon has moved. Update the arrow accordingly.
setVisible(_visible) Show or hide the bubble.
updateEditable() Add or remove the UI indicating if this icon may be clicked or not.