Skip to main content

Class: ContinuousFlyout

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:25

Class for continuous flyout.

Extends​

  • VerticalFlyout

Properties index​

PropertyDescription
autoClosePrevents the flyout from closing automatically when a block is dragged out.
contentsList of flyout elements.
CORNER_RADIUSCorner radius of the flyout background.
GAP_X-
GAP_Y-
height_Height of flyout.
idThe unique id for this component that is used to register with the ComponentManager.
inflatersMap from flyout content type to the corresponding inflater class responsible for creating concrete instances of the content type.
MARGINMargin around the edges of the blocks in the flyout.
RTLIs RTL vs LTR.
scrollAnimationFractionThe percentage of the distance to the scrollTarget that should be scrolled at a time. Lower values will produce a smoother, slower scroll.
SCROLLBAR_MARGINTop/bottom padding between scrollbar and edge of flyout background.
svgBackground_The path around the background of the flyout, which will be filled with a background colour.
svgGroup_The root SVG group for the button or label.
tabWidth_-
toolboxPosition_-
width_Width of flyout.
workspace_-
wouldDelete_Whether the last block or bubble dragged over this delete area would be deleted if dropped on this component. This property is not updated after the block or bubble is deleted.
registryNameThe name of the vertical flyout in the registry.

Methods index​

MethodDescription
autoHideAutomatically hides the flyout if it is an autoclosing flyout.
calculateBottomPaddingCalculates the additional padding needed at the bottom of the flyout in order to make it possible to scroll to the top of the last category.
createDomCreates 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.
disposeDispose of this flyout. Unlink from all DOM elements to prevent memory leaks.
getCategoryScrollPositionReturns the scroll position for the given category name.
getClientRectReturns the bounding rectangle of the drag target area in pixel units relative to viewport.
getContentsGet the list of elements of the current flyout.
getFlyoutScaleGet the scale (zoom level) of the flyout. By default, this matches the target workspace scale, but this can be overridden.
getHeightGet the height of the flyout.
getInflaterForTypeReturns the inflater responsible for constructing items of the given type.
getRecyclableInflaterReturns the recyclable block flyout inflater.
getTargetWorkspaceGet the target workspace inside the flyout.
getWidthGet the width of the flyout.
getWorkspaceGet the workspace inside the flyout.
getXReturns the X coordinate for the flyout's position.
getYCalculates the y coordinate for the flyout position.
headerForCategoryReturns the header item in the flyout corresponding to the given toolbox category, if any.
hideHide and empty the flyout.
initInitializes the flyout.
isVisibleIs the flyout visible?
layout_Lay out the blocks in the flyout.
normalizeSeparatorsUpdates and returns the provided list of flyout contents to flatten separators as needed.
onDragEnterHandles when a cursor with a block or bubble enters this drag target.
onDragExitHandles when a cursor with a block or bubble exits this drag target.
onDragOverHandles when a cursor with a block or bubble is dragged over this drag target.
onDropHandles when a block or bubble is dropped on this component. Should not handle delete here.
positionMove the flyout to the edge of the workspace.
positionAt_Update the view based on coordinates calculated in position().
reflowReflow flyout contents.
reflowInternal_Compute width of flyout. For RTL: Lay out the blocks and buttons to be right-aligned.
scrollToScrolls the flyout to given position.
scrollToCategoryScrolls the flyout to display the given category at the top.
scrollToStartScroll the flyout to the top.
setAutoCloseSets whether this flyout automatically closes when blocks are dragged out, the workspace is clicked, etc, or not.
setBlockIsRecyclableSets the function used to determine whether a block is recyclable.
setContainerVisibleSet whether this flyout's container is visible.
setContentsStore the list of elements on the flyout.
setMetrics_Sets the translation of the flyout to match the scrollbars.
setRecyclingEnabledSet whether the flyout can recycle blocks.
setVisibleSet 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.
shouldPreventMoveReturns whether the provided block or bubble should not be moved after being dropped on this component. If true, the element will return to where it was when the drag started.
showDisplays the given contents in the flyout.
toolboxItemIsLabelValidates and typechecks that the given toolbox item represents a label.
updateAriaContextUpdates the aria attributes for the entire flyout dom. This needs to do two things: 1. Set aria-owns on the flyout's workspace canvas to include the ids of all focusable elements in the flyout. 2. Update the aria attributes on the flyout's workspace. This can't be done at workspace creation because the workspace may not have all required information until the flyout is fully shown.
updateWouldDelete_Updates the internal wouldDelete_ state.
wheel_Handles mouse wheel events.
wouldDeleteReturns whether the provided block or bubble would be deleted if dropped on this area. This method should check if the element is deletable and is always called before onDragEnter/onDragOver/onDragExit.

Constructors​

Constructor​

new ContinuousFlyout(workspaceOptions): ContinuousFlyout;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:53

Creates a new ContinuousFlyout.

Parameters​

ParameterTypeDescription
workspaceOptionsOptionsThe injection options for the flyout's workspace.

Returns​

ContinuousFlyout

Overrides​

Blockly.VerticalFlyout.constructor

Properties​

autoClose​

autoClose: boolean = false;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:46

Prevents the flyout from closing automatically when a block is dragged out.

Overrides​

Blockly.VerticalFlyout.autoClose


contents​

protected contents: FlyoutItem[];

List of flyout elements.

Inherited from​

Blockly.VerticalFlyout.contents


CORNER_RADIUS​

readonly CORNER_RADIUS: number;

Corner radius of the flyout background.

Inherited from​

Blockly.VerticalFlyout.CORNER_RADIUS


GAP_X​

readonly GAP_X: number;

Inherited from​

Blockly.VerticalFlyout.GAP_X


GAP_Y​

readonly GAP_Y: number;

Inherited from​

Blockly.VerticalFlyout.GAP_Y


height_​

protected height_: number;

Height of flyout.

Inherited from​

Blockly.VerticalFlyout.height_


id​

id: string;

The unique id for this component that is used to register with the ComponentManager.

Inherited from​

Blockly.VerticalFlyout.id


inflaters​

protected inflaters: Map<string, IFlyoutInflater>;

Map from flyout content type to the corresponding inflater class responsible for creating concrete instances of the content type.

Inherited from​

Blockly.VerticalFlyout.inflaters


MARGIN​

readonly MARGIN: number;

Margin around the edges of the blocks in the flyout.

Inherited from​

Blockly.VerticalFlyout.MARGIN


RTL​

RTL: boolean;

Is RTL vs LTR.

Inherited from​

Blockly.VerticalFlyout.RTL


scrollAnimationFraction​

protected scrollAnimationFraction: number = 0.3;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:41

The percentage of the distance to the scrollTarget that should be scrolled at a time. Lower values will produce a smoother, slower scroll.


SCROLLBAR_MARGIN​

readonly SCROLLBAR_MARGIN: number;

Top/bottom padding between scrollbar and edge of flyout background.

Inherited from​

Blockly.VerticalFlyout.SCROLLBAR_MARGIN


svgBackground_​

protected svgBackground_: SVGPathElement | null;

The path around the background of the flyout, which will be filled with a background colour.

Inherited from​

Blockly.VerticalFlyout.svgBackground_


svgGroup_​

protected svgGroup_: SVGGElement | null;

The root SVG group for the button or label.

Inherited from​

Blockly.VerticalFlyout.svgGroup_


tabWidth_​

protected readonly tabWidth_: number;

Inherited from​

Blockly.VerticalFlyout.tabWidth_


toolboxPosition_​

protected toolboxPosition_: number;

Inherited from​

Blockly.VerticalFlyout.toolboxPosition_


width_​

protected width_: number;

Width of flyout.

Inherited from​

Blockly.VerticalFlyout.width_


workspace_​

protected workspace_: WorkspaceSvg;

Inherited from​

Blockly.VerticalFlyout.workspace_


wouldDelete_​

protected wouldDelete_: boolean;

Whether the last block or bubble dragged over this delete area would be deleted if dropped on this component. This property is not updated after the block or bubble is deleted.

Inherited from​

Blockly.VerticalFlyout.wouldDelete_


registryName​

static registryName: string;

The name of the vertical flyout in the registry.

Inherited from​

Blockly.VerticalFlyout.registryName

Methods​

autoHide()​

autoHide(onlyClosePopups): void;

Automatically hides the flyout if it is an autoclosing flyout.

Parameters​

ParameterType
onlyClosePopupsboolean

Returns​

void

Inherited from​

Blockly.VerticalFlyout.autoHide


calculateBottomPadding()​

calculateBottomPadding(contentMetrics, viewMetrics): number;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:260

Calculates the additional padding needed at the bottom of the flyout in order to make it possible to scroll to the top of the last category.

Parameters​

ParameterTypeDescription
contentMetricsContainerRegionContent metrics for the flyout.
viewMetricsContainerRegionView metrics for the flyout.

Returns​

number

The additional bottom padding needed.


createDom()​

createDom(tagName): SVGElement;

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.

Parameters​

ParameterTypeDescription
tagNamestring | Svg<SVGSVGElement> | Svg<SVGGElement>The type of tag to put the flyout in. This should be or .

Returns​

SVGElement

The flyout's SVG group.

Inherited from​

Blockly.VerticalFlyout.createDom


dispose()​

dispose(): void;

Dispose of this flyout. Unlink from all DOM elements to prevent memory leaks.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.dispose


getCategoryScrollPosition()​

getCategoryScrollPosition(name): number | null;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:133

Returns the scroll position for the given category name.

Parameters​

ParameterTypeDescription
namestringCategory name.

Returns​

number | null

Scroll position for given category in workspace units, or null if not found.


getClientRect()​

getClientRect(): Rect | null;

Returns the bounding rectangle of the drag target area in pixel units relative to viewport.

Returns​

Rect | null

The component's bounding box. Null if drag target area should be ignored.

Inherited from​

Blockly.VerticalFlyout.getClientRect


getContents()​

getContents(): FlyoutItem[];

Get the list of elements of the current flyout.

Returns​

FlyoutItem[]

The array of flyout elements.

Inherited from​

Blockly.VerticalFlyout.getContents


getFlyoutScale()​

getFlyoutScale(): number;

Get the scale (zoom level) of the flyout. By default, this matches the target workspace scale, but this can be overridden.

Returns​

number

Flyout workspace scale.

Inherited from​

Blockly.VerticalFlyout.getFlyoutScale


getHeight()​

getHeight(): number;

Get the height of the flyout.

Returns​

number

The width of the flyout.

Inherited from​

Blockly.VerticalFlyout.getHeight


getInflaterForType()​

protected getInflaterForType(type): IFlyoutInflater | null;

Returns the inflater responsible for constructing items of the given type.

Parameters​

ParameterTypeDescription
typestringThe type of flyout content item to provide an inflater for.

Returns​

IFlyoutInflater | null

An inflater object for the given type, or null if no inflater is registered for that type.

Inherited from​

Blockly.VerticalFlyout.getInflaterForType


getRecyclableInflater()​

protected getRecyclableInflater(): RecyclableBlockFlyoutInflater;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:335

Returns the recyclable block flyout inflater.

Returns​

RecyclableBlockFlyoutInflater

The recyclable inflater.


getTargetWorkspace()​

getTargetWorkspace(): WorkspaceSvg;

Get the target workspace inside the flyout.

Returns​

WorkspaceSvg

The target workspace inside the flyout.

Inherited from​

Blockly.VerticalFlyout.getTargetWorkspace


getWidth()​

getWidth(): number;

Get the width of the flyout.

Returns​

number

The width of the flyout.

Inherited from​

Blockly.VerticalFlyout.getWidth


getWorkspace()​

getWorkspace(): WorkspaceSvg;

Get the workspace inside the flyout.

Returns​

WorkspaceSvg

The workspace inside the flyout.

Inherited from​

Blockly.VerticalFlyout.getWorkspace


getX()​

getX(): number;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:280

Returns the X coordinate for the flyout's position.

Returns​

number

Overrides​

Blockly.VerticalFlyout.getX


getY()​

getY(): number;

Calculates the y coordinate for the flyout position.

Returns​

number

Y coordinate.

Inherited from​

Blockly.VerticalFlyout.getY


headerForCategory()​

headerForCategory(category): IFocusableNode | undefined;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:202

Returns the header item in the flyout corresponding to the given toolbox category, if any.

Parameters​

ParameterTypeDescription
categoryISelectableToolboxItemThe toolbox category to retrieve header item for.

Returns​

IFocusableNode | undefined

The given category's header item, or undefined if not found.


hide()​

hide(): void;

Hide and empty the flyout.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.hide


init()​

init(targetWorkspace): void;

Initializes the flyout.

Parameters​

ParameterTypeDescription
targetWorkspaceWorkspaceSvgThe workspace in which to create new blocks.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.init


isVisible()​

isVisible(): boolean;

Is the flyout visible?

Returns​

boolean

True if visible.

Inherited from​

Blockly.VerticalFlyout.isVisible


layout_()​

protected layout_(contents): void;

Lay out the blocks in the flyout.

Parameters​

ParameterTypeDescription
contentsFlyoutItem[]The flyout items to lay out.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.layout_


normalizeSeparators()​

protected normalizeSeparators(contents): FlyoutItem[];

Updates 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. A separator at the end is removed outright.

Parameters​

ParameterTypeDescription
contentsFlyoutItem[]The list of flyout contents to flatten separators in.

Returns​

FlyoutItem[]

An updated list of flyout contents with only one separator between each non-separator item, and none at the end.

Inherited from​

Blockly.VerticalFlyout.normalizeSeparators


onDragEnter()​

onDragEnter(_dragElement): void;

Handles when a cursor with a block or bubble enters this drag target.

Parameters​

ParameterTypeDescription
_dragElementIDraggableThe block or bubble currently being dragged.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.onDragEnter


onDragExit()​

onDragExit(_dragElement): void;

Handles when a cursor with a block or bubble exits this drag target.

Parameters​

ParameterTypeDescription
_dragElementIDraggableThe block or bubble currently being dragged.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.onDragExit


onDragOver()​

onDragOver(_dragElement): void;

Handles when a cursor with a block or bubble is dragged over this drag target.

Parameters​

ParameterTypeDescription
_dragElementIDraggableThe block or bubble currently being dragged.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.onDragOver


onDrop()​

onDrop(_dragElement): void;

Handles when a block or bubble is dropped on this component. Should not handle delete here.

Parameters​

ParameterTypeDescription
_dragElementIDraggableThe block or bubble currently being dragged.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.onDrop


position()​

position(): void;

Move the flyout to the edge of the workspace.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.position


positionAt_()​

protected positionAt_(
width,
height,
x,
y
): void;

Update the view based on coordinates calculated in position().

Parameters​

ParameterTypeDescription
widthnumberThe computed width of the flyout's SVG group
heightnumberThe computed height of the flyout's SVG group.
xnumberThe computed x origin of the flyout's SVG group.
ynumberThe computed y origin of the flyout's SVG group.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.positionAt_


reflow()​

reflow(): void;

Reflow flyout contents.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.reflow


reflowInternal_()​

protected reflowInternal_(): void;

Compute width of flyout. For RTL: Lay out the blocks and buttons to be right-aligned.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.reflowInternal_


scrollTo()​

scrollTo(position): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:169

Scrolls the flyout to given position.

Parameters​

ParameterTypeDescription
positionnumberThe Y coordinate to scroll to.

Returns​

void


scrollToCategory()​

scrollToCategory(category): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:186

Scrolls the flyout to display the given category at the top.

Parameters​

ParameterTypeDescription
categoryISelectableToolboxItemThe toolbox category to scroll to in the flyout.

Returns​

void


scrollToStart()​

scrollToStart(): void;

Scroll the flyout to the top.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.scrollToStart


setAutoClose()​

setAutoClose(autoClose): void;

Sets whether this flyout automatically closes when blocks are dragged out, the workspace is clicked, etc, or not.

Parameters​

ParameterType
autoCloseboolean

Returns​

void

Inherited from​

Blockly.VerticalFlyout.setAutoClose


setBlockIsRecyclable()​

setBlockIsRecyclable(func): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:317

Sets the function used to determine whether a block is recyclable.

Parameters​

ParameterTypeDescription
func(block) => booleanThe function used to determine if a block is recyclable.

Returns​

void


setContainerVisible()​

setContainerVisible(visible): void;

Set whether this flyout's container is visible.

Parameters​

ParameterTypeDescription
visiblebooleanWhether the container is visible.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.setContainerVisible


setContents()​

setContents(contents): void;

Store the list of elements on the flyout.

Parameters​

ParameterTypeDescription
contentsFlyoutItem[]The array of items for the flyout.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.setContents


setMetrics_()​

protected setMetrics_(xyRatio): void;

Sets the translation of the flyout to match the scrollbars.

Parameters​

ParameterTypeDescription
xyRatio{ x: number; y: number; }Contains a y property which is a float between 0 and 1 specifying the degree of scrolling and a similar x property.
xyRatio.xnumber-
xyRatio.ynumber-

Returns​

void

Inherited from​

Blockly.VerticalFlyout.setMetrics_


setRecyclingEnabled()​

setRecyclingEnabled(isEnabled): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:326

Set whether the flyout can recycle blocks.

Parameters​

ParameterTypeDescription
isEnabledbooleanTrue to allow blocks to be recycled, false otherwise.

Returns​

void


setVisible()​

setVisible(visible): void;

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.

Parameters​

ParameterTypeDescription
visiblebooleanTrue if visible.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.setVisible


shouldPreventMove()​

shouldPreventMove(_dragElement): boolean;

Returns whether the provided block or bubble should not be moved after being dropped on this component. If true, the element will return to where it was when the drag started.

Parameters​

ParameterTypeDescription
_dragElementIDraggableThe block or bubble currently being dragged.

Returns​

boolean

Whether the block or bubble provided should be returned to drag start.

Inherited from​

Blockly.VerticalFlyout.shouldPreventMove


show()​

show(flyoutDef): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:302

Displays the given contents in the flyout.

Parameters​

ParameterTypeDescription
flyoutDefstring | FlyoutDefinitionA string or JSON object specifying the contents of the flyout.

Returns​

void

Overrides​

Blockly.VerticalFlyout.show


toolboxItemIsLabel()​

protected toolboxItemIsLabel(item): item is LabelFlyoutItem;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:113

Validates and typechecks that the given toolbox item represents a label.

Parameters​

ParameterTypeDescription
itemFlyoutItemThe toolbox item to check.

Returns​

item is LabelFlyoutItem

True if the item represents a label in the flyout, and is a Blockly.FlyoutButton.


updateAriaContext()​

protected updateAriaContext(): void;

Updates the aria attributes for the entire flyout dom. This needs to do two things:

  1. Set aria-owns on the flyout's workspace canvas to include the ids of all focusable elements in the flyout.
  2. Update the aria attributes on the flyout's workspace. This can't be done at workspace creation because the workspace may not have all required information until the flyout is fully shown.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.updateAriaContext


updateWouldDelete_()​

protected updateWouldDelete_(wouldDelete): void;

Updates the internal wouldDelete_ state.

Parameters​

ParameterTypeDescription
wouldDeletebooleanThe new value for the wouldDelete state.

Returns​

void

Inherited from​

Blockly.VerticalFlyout.updateWouldDelete_


wheel_()​

protected wheel_(e): void;

Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:244

Handles mouse wheel events.

Parameters​

ParameterTypeDescription
eWheelEventThe mouse wheel event to handle.

Returns​

void

Overrides​

Blockly.VerticalFlyout.wheel_


wouldDelete()​

wouldDelete(element): boolean;

Returns whether the provided block or bubble would be deleted if dropped on this area. This method should check if the element is deletable and is always called before onDragEnter/onDragOver/onDragExit.

Parameters​

ParameterTypeDescription
elementIDraggableThe block or bubble currently being dragged.

Returns​

boolean

Whether the element provided would be deleted if dropped on this area.

Inherited from​

Blockly.VerticalFlyout.wouldDelete