Speed up rendering by defering connection database construction.

This commit is contained in:
Neil Fraser 2015-01-26 06:57:28 -08:00
parent 03e53d2d68
commit 69ffae6466
2 changed files with 8 additions and 4 deletions

View file

@ -254,9 +254,13 @@ Blockly.Xml.domToBlock = function(workspace, xmlBlock, opt_reuseBlock) {
for (var i = blocks.length - 1; i >= 0; i--) {
blocks[i].render(false);
}
for (var i = blocks.length - 1; i >= 0; i--) {
blocks[i].setConnectionsHidden(false);
}
// Populating the connection database may be defered until after the blocks
// have renderend.
window.setTimeout(function() {
for (var i = blocks.length - 1; i >= 0; i--) {
blocks[i].setConnectionsHidden(false);
}
}, 1);
topBlock.updateDisabled();
// Fire an event to allow scrollbars to resize.
Blockly.fireUiEvent(window, 'resize');