Skip to main content

Home > blockly > Flyout

Flyout class

Class for a flyout.

Signature:

export declare abstract class Flyout extends DeleteArea implements IAutoHideable, IFlyout, IFocusableNode 

Extends: DeleteArea

Implements: IAutoHideable, IFlyout, IFocusableNode

Constructors

ConstructorModifiersDescription
(constructor)(workspaceOptions)Constructs a new instance of the Flyout class

Properties

PropertyModifiersTypeDescription
autoClosebooleanDoes the flyout automatically close when a block is created?
contentsprotectedFlyoutItem[]List of flyout elements.
CORNER_RADIUSreadonlynumberCorner radius of the flyout background.
dragAngleRange_protectednumberRange of a drag angle from a flyout considered "dragging toward workspace". Drags that are within the bounds of this many degrees from the orthogonal line to the flyout edge are considered to be "drags toward the workspace".
GAP_Xreadonlynumber
GAP_Yreadonlynumber
height_protectednumberHeight of flyout.
inflatersprotectedMap<string, IFlyoutInflater>Map from flyout content type to the corresponding inflater class responsible for creating concrete instances of the content type.
MARGINreadonlynumber
RTLboolean
SCROLLBAR_MARGINreadonlynumberTop/bottom padding between scrollbar and edge of flyout background.
svgBackground_protectedSVGPathElement | nullThe path around the background of the flyout, which will be filled with a background colour.
svgGroup_protectedSVGGElement | nullThe root SVG group for the button or label.
tabWidth_protected readonlynumber
toolboxPosition_protectednumber
width_protectednumberWidth of flyout.
workspace_protectedWorkspaceSvg

Methods

MethodModifiersDescription
autoHide(onlyClosePopups)Automatically hides the flyout if it is an autoclosing flyout.
canBeFocused()See IFocusableNode.canBeFocused.
createDom(tagName)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.
dispose()Dispose of this flyout. Unlink from all DOM elements to prevent memory leaks.
getContents()Get the list of elements of the current flyout.
getFlyoutScale()Get the scale (zoom level) of the flyout. By default, this matches the target workspace scale, but this can be overridden.
getFocusableElement()See IFocusableNode.getFocusableElement.
getFocusableTree()See IFocusableNode.getFocusableTree.
getHeight()Get the height of the flyout.
getInflaterForType(type)protectedReturns the inflater responsible for constructing items of the given type.
getNestedTrees()See IFocusableNode.getNestedTrees.
getRestoredFocusableNode(_previousNode)See IFocusableNode.getRestoredFocusableNode.
getRootFocusableNode()See IFocusableNode.getRootFocusableNode.
getTargetWorkspace()Get the target workspace inside the flyout.
getWidth()Get the width of the flyout.
getWorkspace()Get the workspace inside the flyout.
getX()abstractCalculates the x coordinate for the flyout position.
getY()abstractCalculates the y coordinate for the flyout position.
hide()Hide and empty the flyout.
init(targetWorkspace)Initializes the flyout.
isDragTowardWorkspace(currentDragDeltaXY)abstractDetermine 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.
isVisible()Is the flyout visible?
layout_(contents)protected abstractLay out the elements in the flyout.
lookUpFocusableNode(_id)See IFocusableNode.lookUpFocusableNode.
normalizeSeparators(contents)protectedUpdates and returns the provided list of flyout contents to flatten separators as needed. When multiple separators occur one after another, the value of the last one takes precedence and the earlier separators in the group are removed.
onNodeBlur()See IFocusableNode.onNodeBlur.
onNodeFocus()See IFocusableNode.onNodeFocus.
onTreeBlur(_nextTree)See IFocusableNode.onTreeBlur.
onTreeFocus(_node, _previousTree)See IFocusableTree.onTreeFocus.
position()abstractPosition the flyout.
positionAt_(width, height, x, y)protectedUpdate the view based on coordinates calculated in position().
reflow()Reflow flyout contents.
reflowInternal_()protected abstractCompute bounds of flyout. For RTL: Lay out the elements right-aligned.
scrollToStart()abstractScroll the flyout to the beginning of its contents.
serializeBlock(block)protectedSerialize a block to JSON.
setAutoClose(autoClose)Sets whether this flyout automatically closes when blocks are dragged out, the workspace is clicked, etc, or not.
setContainerVisible(visible)Set whether this flyout's container is visible.
setContents(contents)Store the list of elements on the flyout.
setMetrics_(xyRatio)protected abstractSets the translation of the flyout to match the scrollbars.
setVisible(visible)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.
show(flyoutDef)Show and populate the flyout.
wheel_(e)protected abstractScroll the flyout.