Class: ContinuousFlyout
Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:25
Class for continuous flyout.
Extends
VerticalFlyout
Properties index
| Property | Description |
|---|---|
| autoClose | Prevents the flyout from closing automatically when a block is dragged out. |
| contents | List of flyout elements. |
| CORNER_RADIUS | Corner radius of the flyout background. |
| GAP_X | - |
| GAP_Y | - |
| height_ | Height of flyout. |
| id | The unique id for this component that is used to register with the ComponentManager. |
| inflaters | Map from flyout content type to the corresponding inflater class responsible for creating concrete instances of the content type. |
| MARGIN | Margin around the edges of the blocks in the flyout. |
| RTL | Is RTL vs LTR. |
| scrollAnimationFraction | 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 | Top/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. |
| registryName | The name of the vertical flyout in the registry. |
Methods index
| Method | Description |
|---|---|
| autoHide | Automatically hides the flyout if it is an autoclosing flyout. |
| calculateBottomPadding | 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. |
| 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. |
| dispose | Dispose of this flyout. Unlink from all DOM elements to prevent memory leaks. |
| getCategoryScrollPosition | Returns the scroll position for the given category name. |
| getClientRect | Returns the bounding rectangle of the drag target area in pixel units relative to viewport. |
| 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. |
| getHeight | Get the height of the flyout. |
| getInflaterForType | Returns the inflater responsible for constructing items of the given type. |
| getRecyclableInflater | Returns the recyclable block flyout inflater. |
| getTargetWorkspace | Get the target workspace inside the flyout. |
| getWidth | Get the width of the flyout. |
| getWorkspace | Get the workspace inside the flyout. |
| getX | Returns the X coordinate for the flyout's position. |
| getY | Calculates the y coordinate for the flyout position. |
| headerForCategory | Returns the header item in the flyout corresponding to the given toolbox category, if any. |
| hide | Hide and empty the flyout. |
| init | Initializes the flyout. |
| isVisible | Is the flyout visible? |
| layout_ | Lay out the blocks in the flyout. |
| normalizeSeparators | Updates and returns the provided list of flyout contents to flatten separators as needed. |
| onDragEnter | Handles when a cursor with a block or bubble enters this drag target. |
| onDragExit | Handles when a cursor with a block or bubble exits this drag target. |
| onDragOver | Handles when a cursor with a block or bubble is dragged over this drag target. |
| onDrop | Handles when a block or bubble is dropped on this component. Should not handle delete here. |
| position | Move the flyout to the edge of the workspace. |
| positionAt_ | Update the view based on coordinates calculated in position(). |
| reflow | Reflow flyout contents. |
| reflowInternal_ | Compute width of flyout. For RTL: Lay out the blocks and buttons to be right-aligned. |
| scrollTo | Scrolls the flyout to given position. |
| scrollToCategory | Scrolls the flyout to display the given category at the top. |
| scrollToStart | Scroll the flyout to the top. |
| setAutoClose | Sets whether this flyout automatically closes when blocks are dragged out, the workspace is clicked, etc, or not. |
| setBlockIsRecyclable | Sets the function used to determine whether a block is recyclable. |
| setContainerVisible | Set whether this flyout's container is visible. |
| setContents | Store the list of elements on the flyout. |
| setMetrics_ | Sets the translation of the flyout to match the scrollbars. |
| setRecyclingEnabled | Set whether the flyout can recycle blocks. |
| 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. |
| shouldPreventMove | 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. |
| show | Displays the given contents in the flyout. |
| toolboxItemIsLabel | Validates and typechecks that the given toolbox item represents a label. |
| updateAriaContext | 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. |
| updateWouldDelete_ | Updates the internal wouldDelete_ state. |
| wheel_ | Handles mouse wheel events. |
| wouldDelete | 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. |
Constructors
Constructor
new ContinuousFlyout(workspaceOptions): ContinuousFlyout;
Defined in: plugins/continuous-toolbox/src/ContinuousFlyout.ts:53
Creates a new ContinuousFlyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceOptions | Options | The 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
| Parameter | Type |
|---|---|
onlyClosePopups | boolean |
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
| Parameter | Type | Description |
|---|---|---|
contentMetrics | ContainerRegion | Content metrics for the flyout. |
viewMetrics | ContainerRegion | View 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
| Parameter | Type | Description |
|---|---|---|
tagName | string | Svg<SVGSVGElement> | Svg<SVGGElement> | The type of tag to put the flyout in. This should be |
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
| Parameter | Type | Description |
|---|---|---|
name | string | Category 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
| Parameter | Type | Description |
|---|---|---|
type | string | The 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
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
| Parameter | Type | Description |
|---|---|---|
category | ISelectableToolboxItem | The 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
| Parameter | Type | Description |
|---|---|---|
targetWorkspace | WorkspaceSvg | The 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
| Parameter | Type | Description |
|---|---|---|
contents | FlyoutItem[] | 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
| Parameter | Type | Description |
|---|---|---|
contents | FlyoutItem[] | 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
| Parameter | Type | Description |
|---|---|---|
_dragElement | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
_dragElement | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
_dragElement | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
_dragElement | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
width | number | The computed width of the flyout's SVG group |
height | number | The computed height of the flyout's SVG group. |
x | number | The computed x origin of the flyout's SVG group. |
y | number | The 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
| Parameter | Type | Description |
|---|---|---|
position | number | The 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
| Parameter | Type | Description |
|---|---|---|
category | ISelectableToolboxItem | The 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
| Parameter | Type |
|---|---|
autoClose | boolean |
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
| Parameter | Type | Description |
|---|---|---|
func | (block) => boolean | The function used to determine if a block is recyclable. |
Returns
void
setContainerVisible()
setContainerVisible(visible): void;
Set whether this flyout's container is visible.
Parameters
| Parameter | Type | Description |
|---|---|---|
visible | boolean | Whether the container is visible. |
Returns
void
Inherited from
Blockly.VerticalFlyout.setContainerVisible
setContents()
setContents(contents): void;
Store the list of elements on the flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
contents | FlyoutItem[] | 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
| Parameter | Type | Description |
|---|---|---|
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.x | number | - |
xyRatio.y | number | - |
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
| Parameter | Type | Description |
|---|---|---|
isEnabled | boolean | True 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
| Parameter | Type | Description |
|---|---|---|
visible | boolean | True 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
| Parameter | Type | Description |
|---|---|---|
_dragElement | IDraggable | The 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
| Parameter | Type | Description |
|---|---|---|
flyoutDef | string | FlyoutDefinition | A 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
| Parameter | Type | Description |
|---|---|---|
item | FlyoutItem | The 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:
- Set aria-owns on the flyout's workspace canvas to include the ids of all focusable elements in the flyout.
- 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
| Parameter | Type | Description |
|---|---|---|
wouldDelete | boolean | The 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
| Parameter | Type | Description |
|---|---|---|
e | WheelEvent | The 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
| Parameter | Type | Description |
|---|---|---|
element | IDraggable | The 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