Blockly. Icon
Constructor
Icon
new Icon(block)
Class for an icon.
Parameter |
|
---|---|
block |
The block associated with this icon. |
Properties
block_
The block this icon is attached to.
bubble_
Bubble UI (if visible).
collapseHidden
Does this icon get hidden when the block is collapsed.
drawIcon_
Draw the icon.
Parameter |
|
---|---|
group |
Element The icon group. Value must not be null. |
iconGroup_
nullable SVGGElement
The icon SVG group.
iconGroup_
non-null Element
iconGroup_
non-null SVGElement
iconXY_
Absolute coordinate of icon's center.
setVisible
Show or hide the icon.
Parameter |
|
---|---|
visible |
boolean True if the icon should be visible. |
SIZE
Height and width of icons.
Methods
applyColour
applyColour()
Change the colour of the associated bubble to match its block.
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
-
Blockly.utils.Coordinate
Object with x and y properties in workspace coordinates.
iconClick_
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 |
Absolute location in workspace coordinates. Value must not be null. |
updateEditable
updateEditable()
Add or remove the UI indicating if this icon may be clicked or not.