Ignore shadow blocks in the context menu ()

This commit is contained in:
Tim Mickel 2016-04-20 13:18:10 -04:00
parent f1977ded18
commit f23100c52a
2 changed files with 7 additions and 4 deletions

View file

@ -487,12 +487,15 @@ Blockly.Block.prototype.setParent = function(newParent) {
* Includes this block in the list.
* Includes value and block inputs, as well as any following statements.
* Excludes any connection on an output tab or any preceding statements.
* @param {boolean=} opt_ignoreShadows If set, don't include shadow blocks.
* @return {!Array.<!Blockly.Block>} Flattened array of blocks.
*/
Blockly.Block.prototype.getDescendants = function() {
Blockly.Block.prototype.getDescendants = function(opt_ignoreShadows) {
var blocks = [this];
for (var child, x = 0; child = this.childBlocks_[x]; x++) {
blocks.push.apply(blocks, child.getDescendants());
if (!opt_ignoreShadows || !child.isShadow_) {
blocks.push.apply(blocks, child.getDescendants(opt_ignoreShadows));
}
}
return blocks;
};