Block rendering performance (#1363)

* Use Blockly.Field.getCachedWidth instead of non-caching method

* Check for timeout pid before calling clearTimeout
This commit is contained in:
Paul Kaplan
2017-10-13 17:08:52 -04:00
committed by Rachel Fenichel
parent 82705923cb
commit 075bda45a5
2 changed files with 4 additions and 2 deletions

View File

@@ -155,7 +155,7 @@ Blockly.FlyoutButton.prototype.createDom = function() {
this.svgGroup_);
svgText.textContent = this.text_;
this.width = svgText.getComputedTextLength();
this.width = Blockly.Field.getCachedWidth(svgText);
this.height = 20; // Can't compute it :(
if (!this.isLabel_) {

View File

@@ -248,7 +248,9 @@ Blockly.Tooltip.hide = function() {
Blockly.Tooltip.DIV.style.display = 'none';
}
}
clearTimeout(Blockly.Tooltip.showPid_);
if (Blockly.Tooltip.showPid_) {
clearTimeout(Blockly.Tooltip.showPid_);
}
};
/**