mirror of
https://github.com/google/blockly.git
synced 2026-03-10 07:10:11 +01:00
Added empty trashcan function.
This commit is contained in:
@@ -347,6 +347,29 @@ Blockly.Trashcan.prototype.dispose = function() {
|
||||
clearTimeout(this.lidTask_);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if the trashcan contents-flyout is currently open.
|
||||
* @return {boolean} True if the trashcan contents-flyout is currently open.
|
||||
*/
|
||||
Blockly.Trashcan.prototype.contentsIsOpen = function() {
|
||||
return this.flyout.isVisible();
|
||||
};
|
||||
|
||||
/**
|
||||
* Empties the trashcan's contents. If the contents-flyout is currently open
|
||||
* it will be closed.
|
||||
*/
|
||||
Blockly.Trashcan.prototype.emptyContents = function() {
|
||||
if (!this.contents_.length) {
|
||||
return;
|
||||
}
|
||||
this.contents_.length = 0;
|
||||
this.setMinOpenness_(0);
|
||||
if (this.contentsIsOpen()) {
|
||||
this.flyout.hide();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Position the trashcan.
|
||||
* It is positioned in the opposite corner to the corner the
|
||||
|
||||
Reference in New Issue
Block a user