Skip to main content

Class: SeparatorFlyoutInflater

Defined in: packages/blockly/core/separator_flyout_inflater.ts:22

Class responsible for creating separators for flyouts.

Implements

Methods index

MethodDescription
loadInflates a dummy flyout separator.
gapForItemReturns the size of the separator. See load for more details.
disposeItemDisposes of the given separator. Intentional no-op.
getTypeReturns the type of items this inflater is responsible for creating.

Constructors

Constructor

new SeparatorFlyoutInflater(): SeparatorFlyoutInflater;

Returns

SeparatorFlyoutInflater

Methods

load()

load(_state, flyout): FlyoutItem;

Defined in: packages/blockly/core/separator_flyout_inflater.ts:41

Inflates a dummy flyout separator.

The flyout automatically creates separators between every element with a size determined by calling gapForElement on the relevant inflater. Additionally, users can explicitly add separators in the flyout definition. When separators (implicitly or explicitly created) follow one another, the gap of the last one propagates backwards and flattens to one separator. This flattening is not additive; if there are initially separators of 2, 3, and 4 pixels, after normalization there will be one separator of 4 pixels. Therefore, this method returns a zero-width separator, which will be replaced by the one implicitly created by the flyout based on the value returned by gapForElement, which knows the default gap, unlike this method.

Parameters

ParameterTypeDescription
_stateobjectA JSON representation of a flyout separator.
flyoutIFlyoutThe flyout to create the separator for.

Returns

FlyoutItem

A newly created FlyoutSeparator.

Implementation of

IFlyoutInflater.load


gapForItem()

gapForItem(state, defaultGap): number;

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

Returns the size of the separator. See load for more details.

Parameters

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

Returns

number

The desired size of the separator.

Implementation of

IFlyoutInflater.gapForItem


disposeItem()

disposeItem(_item): void;

Defined in: packages/blockly/core/separator_flyout_inflater.ts:67

Disposes of the given separator. Intentional no-op.

Parameters

ParameterTypeDescription
_itemFlyoutItemThe flyout separator to dispose of.

Returns

void

Implementation of

IFlyoutInflater.disposeItem


getType()

getType(): string;

Defined in: packages/blockly/core/separator_flyout_inflater.ts:74

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