Stay organized with collections Save and categorize content based on your preferences.

blockly > IDragTarget

IDragTarget interface

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

Signature:

export interface IDragTarget extends IComponent 

Extends: IComponent

Methods

Method Description
getClientRect() Returns the bounding rectangle of the drag target area in pixel units relative to viewport.
onDragEnter(dragElement) Handles when a cursor with a block or bubble enters this drag target.
onDragExit(dragElement) Handles when a cursor with a block or bubble exits this drag target.
onDragOver(dragElement) Handles when a cursor with a block or bubble is dragged over this drag target.
onDrop(dragElement) Handles when a block or bubble is dropped on this component. Should not handle delete here.
shouldPreventMove(dragElement) 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.