Blockly. IFlyout
Interface for a flyout.
Properties
autoClose
boolean
Does the flyout automatically close when a block is created?
CORNER_RADIUS
number
Corner radius of the flyout background.
createBlock
Create a copy of this block on the workspace.
Parameter |
|
---|---|
originalBlock |
The block to copy from the flyout. Value must not be null. |
- Throws
-
Error
if something went wrong with deserialization. - Returns
-
non-null Blockly.BlockSvg
The newly created block.
createDom
Creates the flyout's DOM. Only needs to be called once. The flyout can either exist as its own svg element or be a g element nested inside a separate svg element.
Parameter |
|
---|---|
tagName |
(string, non-null Blockly.utils.Svg containing non-null SVGSVGElement, or non-null Blockly.utils.Svg containing non-null SVGGElement) The type of tag to put the flyout in. This should be |
- Returns
-
non-null SVGElement
The flyout's SVG group.
dispose
Dispose of this flyout. Unlink from all DOM elements to prevent memory leaks.
getHeight
Get the height of the flyout.
- Returns
-
number
The width of the flyout.
getWidth
Get the width of the flyout.
- Returns
-
number
The width of the flyout.
getWorkspace
Get the workspace inside the flyout.
- Returns
-
non-null Blockly.WorkspaceSvg
The workspace inside the flyout.
getX
Calculates the x coordinate for the flyout position.
- Returns
-
number
X coordinate.
getY
Calculates the y coordinate for the flyout position.
- Returns
-
number
Y coordinate.
hide
Hide and empty the flyout.
horizontalLayout
boolean
Whether the flyout is laid out horizontally or not.
init
Initializes the flyout.
Parameter |
|
---|---|
targetWorkspace |
The workspace in which to create new blocks. Value must not be null. |
isDragTowardWorkspace
Determine if a drag delta is toward the workspace, based on the position and orientation of the flyout. This is used in determineDragIntention_ to determine if a new block should be created or if the flyout should scroll.
Parameter |
|
---|---|
currentDragDeltaXY |
How far the pointer has moved from the position at mouse down, in pixel units. Value must not be null. |
- Returns
-
boolean
True if the drag is toward the workspace.
isScrollable
- Returns
-
boolean
True if this flyout may be scrolled with a scrollbar or by dragging.
isVisible
Is the flyout visible?
- Returns
-
boolean
True if visible.
MARGIN
number
Margin around the edges of the blocks in the flyout.
position
Position the flyout.
- Returns
-
void
reflow
Reflow blocks and their mats.
RTL
boolean
Is RTL vs LTR.
setContainerVisible
Set whether this flyout's container is visible.
Parameter |
|
---|---|
visible |
boolean Whether the container is visible. |
setVisible
Set whether the flyout is visible. A value of true does not necessarily mean that the flyout is shown. It could be hidden because its container is hidden.
Parameter |
|
---|---|
visible |
boolean True if visible. |
show
Show and populate the flyout.
Parameter |
|
---|---|
flyoutDef |
(non-null Blockly.utils.toolbox.FlyoutDefinition or string) Contents to display in the flyout. This is either an array of Nodes, a NodeList, a toolbox definition, or a string with the name of the dynamic category. |
targetWorkspace
nullable Blockly.WorkspaceSvg
The target workspace