Commit 8275273a authored by neil.fraser@gmail.com's avatar neil.fraser@gmail.com

Speed up getDescendants and setCollapsed.

git-svn-id: http://blockly.googlecode.com/svn/trunk@1708 c400ca83-b69d-9dd7-9705-49c6b8615e23
parent f3cf277f
This diff is collapsed.
......@@ -1083,7 +1083,7 @@ Blockly.Block.prototype.setParent = function(newParent) {
Blockly.Block.prototype.getDescendants = function() {
var blocks = [this];
for (var child, x = 0; child = this.childBlocks_[x]; x++) {
blocks = blocks.concat(child.getDescendants());
blocks.push.apply(child.getDescendants());
}
return blocks;
};
......@@ -1423,7 +1423,7 @@ Blockly.Block.prototype.setCollapsed = function(collapsed) {
var renderList = [];
// Show/hide the inputs.
for (var x = 0, input; input = this.inputList[x]; x++) {
renderList = renderList.concat(input.setVisible(!collapsed));
renderList.push.apply(input.setVisible(!collapsed));
}
var COLLAPSED_INPUT_NAME = '_TEMP_COLLAPSED_INPUT';
......
......@@ -675,7 +675,7 @@ Blockly.Connection.prototype.unhideAll = function() {
connections = block.getConnections_(true);
}
for (var c = 0; c < connections.length; c++) {
renderList = renderList.concat(connections[c].unhideAll());
renderList.push.apply(connections[c].unhideAll());
}
if (renderList.length == 0) {
// Leaf block.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment