blockly > Trashcan

Trashcan class

Class for a trash can.

Signature:

export declare class Trashcan extends DeleteArea implements IAutoHideable, IPositionable 

Extends: DeleteArea

Implements: IAutoHideable, IPositionable

Constructors

Constructor Modifiers Description
(constructor)(workspace) Constructs a new instance of the Trashcan class

Properties

Property Modifiers Type Description
id string The unique id for this component that is used to register with the ComponentManager.
isLidOpen boolean Current open/close state of the lid.

Methods

Method Modifiers Description
autoHide(onlyClosePopups) Hides the component. Called in WorkspaceSvg.hideChaff.
click() Inspect the contents of the trash.
closeFlyout() Closes the trashcan flyout.
closeLid() Flip the lid shut. Called externally after a drag.
contentsIsOpen() Returns true if the trashcan contents-flyout is currently open.
createDom() Create the trash can elements.
dispose() Dispose of this trash can. Unlink from all DOM elements to prevent memory leaks.
emptyContents() Empties the trashcan's contents. If the contents-flyout is currently open it will be closed.
getBoundingRectangle() Returns the bounding rectangle of the UI element in pixel units relative to the Blockly injection div.
getClientRect() Returns the bounding rectangle of the drag target area in pixel units relative to viewport.
init() Initializes the trash can.
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.
openFlyout() Opens the trashcan flyout.
position(metrics, savedPositions) Positions the trashcan. It is positioned in the opposite corner to the corner the categories/toolbox starts at.