Constructor

Icon

new Icon(block)

Class for an icon.

Parameter

block

Blockly.BlockSvg

The block associated with this icon.

Properties

block_

protected

Blockly.BlockSvg

The block this icon is attached to.

bubble_

protected

Blockly.Bubble

Bubble UI (if visible).

collapseHidden

Does this icon get hidden when the block is collapsed.

iconGroup_

non-null Element

iconXY_

protected

Blockly.utils.Coordinate

Absolute coordinate of icon's center.

SIZE

Height and width of icons.

Methods

computeIconLocation

computeIconLocation()

Notification that the icon has moved, but we don't really know where. Recompute the icon's location from scratch.

createIcon

createIcon()

Create the icon on the block.

dispose

dispose()

Dispose of this icon.

getCorrectedSize

getCorrectedSize() returns Blockly.utils.Size

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.

Returns

non-null Blockly.utils.Size Height and width.

getIconLocation

getIconLocation() returns Blockly.utils.Coordinate

Returns the center of the block's icon relative to the surface.

Returns

non-null Blockly.utils.Coordinate Object with x and y properties in workspace coordinates.

iconClick_

protected

iconClick_(e)

Clicking on the icon toggles if the bubble is visible.

Parameter

e

Event

Mouse click event.

Value must not be null.

isVisible

isVisible() returns boolean

Is the associated bubble visible?

Returns

boolean True if the bubble is visible.

setIconLocation

setIconLocation(xy)

Notification that the icon has moved. Update the arrow accordingly.

Parameter

xy

Blockly.utils.Coordinate

Absolute location in workspace coordinates.

Value must not be null.

updateColour

updateColour()

Change the colour of the associated bubble to match its block.

updateEditable

updateEditable()

Add or remove the UI indicating if this icon may be clicked or not.