Skip to main content

blockly > FlyoutButton

FlyoutButton class

Class for a button or label in the flyout.

Signature:

export declare class FlyoutButton implements IBoundedElement, IRenderedElement, IFocusableNode 

Implements: IBoundedElement, IRenderedElement, IFocusableNode

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the FlyoutButton class.

Properties

Property

Modifiers

Type

Description

BORDER_RADIUS

static

number

The radius of the flyout button's borders.

callbackKey

readonly

string

The key to the function called when this button is activated.

cursorSvg

SVGElement | null

Holds the cursors svg element when the cursor is attached to the button. This is null if there is no cursor on the button.

height

number

The height of the button's rect.

info

toolbox.ButtonOrLabelInfo

TEXT_MARGIN_X

static

number

The horizontal margin around the text in the button.

TEXT_MARGIN_Y

static

number

The vertical margin around the text in the button.

width

number

The width of the button's rect.

Methods

Method

Modifiers

Description

canBeFocused()

See IFocusableNode.canBeFocused.

createDom()

dispose()

Dispose of this button.

getBoundingRectangle()

Returns the coordinates of a bounded element describing the dimensions of the element. Coordinate system: workspace coordinates.

getButtonText()

getFocusableElement()

See IFocusableNode.getFocusableElement.

getFocusableTree()

See IFocusableNode.getFocusableTree.

getSvgRoot()

getTargetWorkspace()

Get the button's target workspace.

getWorkspace()

Get the button's workspace.

isLabel()

moveBy(dx, dy, _reason)

Move the element by a relative offset.

moveTo(x, y)

Move the button to the given x, y coordinates.

onNodeBlur()

See IFocusableNode.onNodeBlur.

onNodeFocus()

See IFocusableNode.onNodeFocus.

setCursorSvg(cursorSvg)

Add the cursor SVG to this buttons's SVG group.

show()

Correctly position the flyout button and make it visible.