Class: DragTarget

Constructor

DragTarget

new DragTarget()

Abstract class for a component with custom behaviour when a block or bubble is dragged over or dropped on top of it.

Implements
Blockly.IDragTarget

Property

getClientRect

Returns the bounding rectangle of the drag target area in pixel units relative to the Blockly injection div.

Implements
Blockly.IDragTarget#getClientRect
Returns

nullable Blockly.utils.Rect The component's bounding box. Null if drag target area should be ignored.

Methods

onDragEnter

onDragEnter(_dragElement)

Handles when a cursor with a block or bubble enters this drag target.

Parameter

_dragElement

Blockly.IDraggable

The block or bubble currently being dragged.

Value must not be null.

Implements
Blockly.IDragTarget#onDragEnter

onDragExit

onDragExit(_dragElement)

Handles when a cursor with a block or bubble exits this drag target.

Parameter

_dragElement

Blockly.IDraggable

The block or bubble currently being dragged.

Value must not be null.

Implements
Blockly.IDragTarget#onDragExit

onDragOver

onDragOver(_dragElement)

Handles when a cursor with a block or bubble is dragged over this drag target.

Parameter

_dragElement

Blockly.IDraggable

The block or bubble currently being dragged.

Value must not be null.

Implements
Blockly.IDragTarget#onDragOver

onDrop

onDrop(_dragElement)

Handles when a block or bubble is dropped on this component. Should not handle delete here.

Parameter

_dragElement

Blockly.IDraggable

The block or bubble currently being dragged.

Value must not be null.

Implements
Blockly.IDragTarget#onDrop

shouldPreventMove

shouldPreventMove(_dragElement) returns 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.

Parameter

_dragElement

Blockly.IDraggable

The block or bubble currently being dragged.

Value must not be null.

Implements
Blockly.IDragTarget#shouldPreventMove
Returns

boolean Whether the block or bubble provided should be returned to drag start.