Constructor

InsertionMarkerManager

new InsertionMarkerManager(block)

Class that controls updates to connections during drags. It is primarily responsible for finding the closest eligible connection and highlighting or unhiglighting it as needed during a drag.

Parameter

block

Blockly.BlockSvg

The top block in the stack being dragged.

Value must not be null.

Methods

applyConnections

package

applyConnections()

Connect to the closest connection and render the results. This should be called at the end of a drag.

dispose

package

dispose()

Sever all links from this object.

getCandidate_

getCandidate_(dxy) returns Object

Find the nearest valid connection, which may be the same as the current closest connection.

Parameter

dxy

Blockly.utils.Coordinate

Position relative to drag start, in workspace units.

Value must not be null.

Returns

non-null Object An object containing a local connection, a closest connection, and a radius.

getInsertionMarkers

package

getInsertionMarkers() returns Array of non-null Blockly.BlockSvg

Get a list of the insertion markers that currently exist. Drags have 0, 1, or 2 insertion markers.

Returns

non-null Array of non-null Blockly.BlockSvg A possibly empty list of insertion marker blocks.

highlightBlock_

highlightBlock_()

Add highlighting showing which block will be replaced.

unhighlightBlock_

unhighlightBlock_()

Get rid of the highlighting marking the block that will be replaced.

update

package

update(dxy, deleteArea)

Update highlighted connections based on the most recent move location.

Parameter

dxy

Blockly.utils.Coordinate

Position relative to drag start, in workspace units.

Value must not be null.

deleteArea

number

One of Blockly.DELETE_AREA_TRASH, Blockly.DELETE_AREA_TOOLBOX, or Blockly.DELETE_AREA_NONE.

Value may be null.

wouldConnectBlock

package

wouldConnectBlock() returns boolean

Return whether the block would be connected if dropped immediately, based on information from the most recent move event.

Returns

boolean True if the block would be connected if dropped immediately.

wouldDeleteBlock

package

wouldDeleteBlock() returns boolean

Return whether the block would be deleted if dropped immediately, based on information from the most recent move event.

Returns

boolean True if the block would be deleted if dropped immediately.