mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Distinguish between unset maxInstance and set to 0. (#3949)
This commit is contained in:
@@ -530,8 +530,11 @@ Blockly.Workspace.prototype.remainingCapacityOfType = function(type) {
|
||||
if (!this.options.maxInstances) {
|
||||
return Infinity;
|
||||
}
|
||||
return (this.options.maxInstances[type] || Infinity) -
|
||||
this.getBlocksByType(type, false).length;
|
||||
|
||||
var maxInstanceOfType = (this.options.maxInstances[type] !== undefined) ?
|
||||
this.options.maxInstances[type] : Infinity;
|
||||
|
||||
return maxInstanceOfType - this.getBlocksByType(type, false).length;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user