Improve rendering speed.

This commit is contained in:
Neil Fraser 2015-01-26 04:56:58 -08:00
parent 3e893da239
commit aa5afd18f6
5 changed files with 43 additions and 14 deletions

View file

@ -248,11 +248,15 @@ Blockly.Xml.domToBlock = function(workspace, xmlBlock, opt_reuseBlock) {
var blocks = topBlock.getDescendants();
// Render each block.
for (var i = blocks.length - 1; i >= 0; i--) {
blocks[i].setConnectionsHidden(true);
blocks[i].initSvg();
}
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);
}
topBlock.updateDisabled();
// Fire an event to allow scrollbars to resize.
Blockly.fireUiEvent(window, 'resize');