Blockly. FlyoutButton
Constructor
FlyoutButton
new FlyoutButton(workspace, targetWorkspace, json, isLabel)
Class for a button in the flyout.
Parameter |
|
---|---|
workspace |
The workspace in which to place this button. Value must not be null. |
targetWorkspace |
The flyout's target workspace. Value must not be null. |
json |
Blockly.utils.toolbox.ButtonOrLabelInfo The JSON specifying the label/button. Value must not be null. |
isLabel |
boolean Whether this button should be styled as a label. |
Properties
MARGIN_X
The horizontal margin around the text in the button.
MARGIN_Y
The vertical margin around the text in the button.
height
number
The height of the button's rect.
info
non-null Blockly.utils.toolbox.ButtonOrLabelInfo
The JSON specifying the label / button.
width
number
The width of the button's rect.
Methods
createDom
createDom() returns SVGElement
Create the button elements.
- Returns
-
non-null SVGElement
The button's SVG group.
dispose
dispose()
Dispose of this button.
getButtonText
getButtonText() returns string
- Returns
-
string
Text of the button.
getPosition
getPosition() returns Blockly.utils.Coordinate
Location of the button.
- Returns
-
non-null Blockly.utils.Coordinate
x, y coordinates.
getTargetWorkspace
getTargetWorkspace() returns Blockly.WorkspaceSvg
Get the button's target workspace.
- Returns
-
non-null Blockly.WorkspaceSvg
The target workspace of the flyout where this button resides.
isLabel
isLabel() returns boolean
- Returns
-
boolean
Whether or not the button is a label.
moveTo
moveTo(x, y)
Move the button to the given x, y coordinates.
Parameter |
|
---|---|
x |
number The new x coordinate. |
y |
number The new y coordinate. |
show
show()
Correctly position the flyout button and make it visible.