Class: Trashcan

Constructor

Trashcan

new Trashcan(workspace)

Class for a trash can.

Parameter

workspace

Blockly.WorkspaceSvg

The workspace to sit in.

Value must not be null.

Implements
Blockly.IDeleteArea

Properties

flyout

package

Blockly.IFlyout

The trashcan flyout.

isLidOpen

boolean

Current open/close state of the lid.

Methods

click

click()

Inspect the contents of the trash.

closeFlyout

closeFlyout()

Closes the trashcan flyout.

closeLid

closeLid()

Flip the lid shut. Called externally after a drag.

contentsIsOpen

contentsIsOpen() returns boolean

Returns true if the trashcan contents-flyout is currently open.

Returns

boolean True if the trashcan contents-flyout is currently open.

createDom

createDom() returns SVGElement

Create the trash can elements.

Returns

non-null SVGElement The trash can's SVG group.

dispose

dispose()

Dispose of this trash can. Unlink from all DOM elements to prevent memory leaks.

emptyContents

emptyContents()

Empties the trashcan's contents. If the contents-flyout is currently open it will be closed.

getClientRect

getClientRect() returns Blockly.utils.Rect

Return the deletion rectangle for this trash can.

Implements
Blockly.IDeleteArea#getClientRect
Returns

Blockly.utils.Rect Rectangle in which to delete.

init

init(verticalSpacing) returns number

Initialize the trash can.

Parameter

verticalSpacing

number

Vertical distance from workspace edge to the same edge of the trashcan.

Returns

number Vertical distance from workspace edge to the opposite edge of the trashcan.

openFlyout

openFlyout()

Opens the trashcan flyout.

position

position()

Position the trashcan. It is positioned in the opposite corner to the corner the categories/toolbox starts at.

setLidOpen

package

setLidOpen(state)

Flip the lid open or shut.

Parameter

state

boolean

True if open.