Constructor

Icon

new Icon(block)

Class for an icon.

Parameter

block

Blockly.Block

The block associated with this icon.

Properties

bubble_

protected

Blockly.Bubble

Bubble UI (if visible).

collapseHidden

Does this icon get hidden when the block is collapsed.

iconXY_

protected

goog.math.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.

getIconLocation

getIconLocation() returns goog.math.Coordinate

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

Returns

non-null goog.math.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.

renderIcon

renderIcon(cursorX) returns number

Render the icon.

Parameter

cursorX

number

Horizontal offset at which to position the icon.

Returns

number Horizontal offset for next item to draw.

setIconLocation

setIconLocation(xy)

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

Parameter

xy

goog.math.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.