Skip to main content

Class: BlockFlyoutInflater

Defined in: packages/blockly/core/block_flyout_inflater.ts:36

Class responsible for creating blocks for flyouts.

Implements

Properties index

PropertyDescription
permanentlyDisabledBlocks-
listeners-
flyout-

Methods index

MethodDescription
loadInflates a flyout block from the given state and adds it to the flyout.
createBlockCreates a block on the given workspace.
gapForItemReturns the amount of space that should follow this block.
disposeItemDisposes of the given block.
removeListenersRemoves event listeners for the block with the given ID.
setFlyoutUpdates this inflater's flyout.
addBlockListenersAdd listeners to a block that has been added to the flyout.
getTypeReturns the type of items this inflater is responsible for creating.

Constructors

Constructor

new BlockFlyoutInflater(): BlockFlyoutInflater;

Defined in: packages/blockly/core/block_flyout_inflater.ts:45

Creates a new BlockFlyoutInflater instance.

Returns

BlockFlyoutInflater

Properties

permanentlyDisabledBlocks

protected permanentlyDisabledBlocks: Set<BlockSvg>;

Defined in: packages/blockly/core/block_flyout_inflater.ts:37


listeners

protected listeners: Map<string, Data[]>;

Defined in: packages/blockly/core/block_flyout_inflater.ts:38


flyout?

protected optional flyout?: IFlyout;

Defined in: packages/blockly/core/block_flyout_inflater.ts:39

Methods

load()

load(state, flyout): FlyoutItem;

Defined in: packages/blockly/core/block_flyout_inflater.ts:56

Inflates a flyout block from the given state and adds it to the flyout.

Parameters

ParameterTypeDescription
stateobjectA JSON representation of a flyout block.
flyoutIFlyoutThe flyout to create the block on.

Returns

FlyoutItem

A newly created block.

Implementation of

IFlyoutInflater.load


createBlock()

createBlock(blockDefinition, workspace): BlockSvg;

Defined in: packages/blockly/core/block_flyout_inflater.ts:113

Creates a block on the given workspace.

Parameters

ParameterTypeDescription
blockDefinitionBlockInfoA JSON representation of the block to create.
workspaceWorkspaceSvgThe workspace to create the block on.

Returns

BlockSvg

The newly created block.


gapForItem()

gapForItem(state, defaultGap): number;

Defined in: packages/blockly/core/block_flyout_inflater.ts:156

Returns the amount of space that should follow this block.

Parameters

ParameterTypeDescription
stateobjectA JSON representation of a flyout block.
defaultGapnumberThe default spacing for flyout items.

Returns

number

The amount of space that should follow this block.

Implementation of

IFlyoutInflater.gapForItem


disposeItem()

disposeItem(item): void;

Defined in: packages/blockly/core/block_flyout_inflater.ts:178

Disposes of the given block.

Parameters

ParameterTypeDescription
itemFlyoutItemThe flyout block to dispose of.

Returns

void

Implementation of

IFlyoutInflater.disposeItem


removeListeners()

protected removeListeners(blockId): void;

Defined in: packages/blockly/core/block_flyout_inflater.ts:191

Removes event listeners for the block with the given ID.

Parameters

ParameterTypeDescription
blockIdstringThe ID of the block to remove event listeners from.

Returns

void


setFlyout()

protected setFlyout(flyout): void;

Defined in: packages/blockly/core/block_flyout_inflater.ts:202

Updates this inflater's flyout.

Parameters

ParameterTypeDescription
flyoutIFlyoutThe flyout that owns this inflater.

Returns

void


addBlockListeners()

protected addBlockListeners(block): void;

Defined in: packages/blockly/core/block_flyout_inflater.ts:237

Add listeners to a block that has been added to the flyout.

Parameters

ParameterTypeDescription
blockBlockSvgThe block to add listeners for.

Returns

void


getType()

getType(): string;

Defined in: packages/blockly/core/block_flyout_inflater.ts:305

Returns the type of items this inflater is responsible for creating.

Returns

string

An identifier for the type of items this inflater creates.

Implementation of

IFlyoutInflater.getType