Fixed multiple trashcans on the same page leaking state.

This commit is contained in:
Beka Westberg
2019-02-12 13:52:46 -08:00
parent 442479581a
commit 772c501ac3

View File

@@ -37,7 +37,28 @@ goog.require('goog.math.Rect');
* @constructor
*/
Blockly.Trashcan = function(workspace) {
/**
* The workspace the trashcan sits in.
* @type {!Blockly.Workspace}
* @private
*/
this.workspace_ = workspace;
/**
* True if the trashcan contains blocks, otherwise false.
* @type {boolean}
* @private
*/
this.hasBlocks_ = false;
/**
* A list of Xml (stored as strings) representing blocks "inside" the trashcan.
* @type {Array}
* @private
*/
this.contents_ = [];
if (this.workspace_.options.maxTrashcanContents <= 0) {
return;
}
@@ -142,20 +163,6 @@ Blockly.Trashcan.prototype.isOpen = false;
*/
Blockly.Trashcan.prototype.minOpenness_ = 0;
/**
* True if the trashcan contains blocks, otherwise false.
* @type {boolean}
* @private
*/
Blockly.Trashcan.prototype.hasBlocks_ = false;
/**
* A list of Xml (stored as strings) representing blocks "inside" the trashcan.
* @type {Array}
* @private
*/
Blockly.Trashcan.prototype.contents_ = [];
/**
* The SVG group containing the trash can.
* @type {Element}