mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
Fixed Filter Capacity not Considering Child Blocks. (#2155)
This commit is contained in:
@@ -725,13 +725,11 @@ Blockly.Flyout.prototype.moveRectToBlock_ = function(rect, block) {
|
||||
* @private
|
||||
*/
|
||||
Blockly.Flyout.prototype.filterForCapacity_ = function() {
|
||||
var remainingCapacity = this.targetWorkspace_.remainingCapacity();
|
||||
var blocks = this.workspace_.getTopBlocks(false);
|
||||
for (var i = 0, block; block = blocks[i]; i++) {
|
||||
if (this.permanentlyDisabled_.indexOf(block) == -1) {
|
||||
var allBlocks = block.getDescendants(false);
|
||||
block.setDisabled(allBlocks.length > remainingCapacity ||
|
||||
this.targetWorkspace_.remainingCapacityOfType(block.type) <= 0);
|
||||
block.setDisabled(!this.targetWorkspace_
|
||||
.isCapacityAvailable(Blockly.utils.getBlockTypeCounts(block)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user