bringToFront optimization for large workspaces (#3214)

* bringToFront optimization for large workspaces
This commit is contained in:
Sam El-Husseini
2019-10-09 16:08:23 -07:00
committed by GitHub
parent 3368a9f713
commit e18dcd1bea

View File

@@ -1375,7 +1375,12 @@ Blockly.BlockSvg.prototype.bringToFront = function() {
var block = this;
do {
var root = block.getSvgRoot();
root.parentNode.appendChild(root);
var parent = root.parentNode;
var childNodes = parent.childNodes;
// Avoid moving the block if it's already at the bottom.
if (childNodes[childNodes.length - 1] !== root) {
parent.appendChild(root);
}
block = block.getParent();
} while (block);
};