Skip to main content

Class: InsertionMarkerPreviewer

Defined in: packages/blockly/core/insertion_marker_previewer.ts:21

Displays visual "previews" of where a block will be connected if it is dropped.

Implements

Properties index

PropertyDescription
useFastInsertionMarkersIf set to true, uses a faster method for rendering insertion markers which will become the default in v14. This rendering method is enabled for the built-in Thrasos, Geras and Zelos renderers regardless of the state of this flag. Custom renderers will use the old rendering behavior unless this is set to true. This field will be removed in v14.

Methods index

MethodDescription
previewReplacementDisplay a connection preview where the draggedCon connects to the staticCon, replacing the replacedBlock (currently connected to the staticCon).
previewConnectionDisplay a connection preview where the draggedCon connects to the staticCon, and no block is being replaced.
serializeBlockToInsertionMarkerTransforms the given block into a JSON representation used to construct an insertion marker.
hidePreviewHide any previews that are currently displayed.
disposeDispose of any references held by this connection previewer.

Constructors

Constructor

new InsertionMarkerPreviewer(draggedBlock): InsertionMarkerPreviewer;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:43

Parameters

ParameterType
draggedBlockBlockSvg

Returns

InsertionMarkerPreviewer

Properties

useFastInsertionMarkers

static useFastInsertionMarkers: boolean = false;

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

If set to true, uses a faster method for rendering insertion markers which will become the default in v14. This rendering method is enabled for the built-in Thrasos, Geras and Zelos renderers regardless of the state of this flag. Custom renderers will use the old rendering behavior unless this is set to true. This field will be removed in v14.

Methods

previewReplacement()

previewReplacement(
draggedConn,
staticConn,
replacedBlock
): void;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:60

Display a connection preview where the draggedCon connects to the staticCon, replacing the replacedBlock (currently connected to the staticCon).

Parameters

ParameterTypeDescription
draggedConnRenderedConnectionThe connection on the block stack being dragged.
staticConnRenderedConnectionThe connection not being dragged that we are connecting to.
replacedBlockBlockSvgThe block currently connected to the staticCon that is being replaced.

Returns

void

Implementation of

IConnectionPreviewer.previewReplacement


previewConnection()

previewConnection(draggedConn, staticConn): void;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:87

Display a connection preview where the draggedCon connects to the staticCon, and no block is being replaced.

Parameters

ParameterTypeDescription
draggedConnRenderedConnectionThe connection on the block stack being dragged.
staticConnRenderedConnectionThe connection not being dragged that we are connecting to.

Returns

void

Implementation of

IConnectionPreviewer.previewConnection


serializeBlockToInsertionMarker()

protected serializeBlockToInsertionMarker(block): State;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:186

Transforms the given block into a JSON representation used to construct an insertion marker.

Parameters

ParameterTypeDescription
blockBlockSvgThe block to serialize and use as an insertion marker.

Returns

State

A JSON-formatted string corresponding to a serialized representation of the given block suitable for use as an insertion marker.


hidePreview()

hidePreview(): void;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:244

Hide any previews that are currently displayed.

Returns

void

Implementation of

IConnectionPreviewer.hidePreview


dispose()

dispose(): void;

Defined in: packages/blockly/core/insertion_marker_previewer.ts:291

Dispose of any references held by this connection previewer.

Returns

void

Implementation of

IConnectionPreviewer.dispose