Merge pull request #2292 from BeksOmega/fixes/MultipleTrashcans

Fixed multiple trashcans on the same page leaking state.
This commit is contained in:
Rachel Fenichel
2019-02-15 16:16:58 -08:00
committed by GitHub

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}