Defer comment rendering if workspace not rendered

When a Blockly workspace has not been rendered for the first time,
e.g. due to Firefox SVG exceptions, the comment bubbles do not have a
canvas to attach to. This fix sets a `visible` field on the comment
object during load of a Blockly workspace that can be used to trigger
an SVG update once the workspace has been rendered.
This commit is contained in:
Evan W. Patton
2017-01-27 09:39:31 -05:00
parent 3307a4b397
commit f0f7128aff

View File

@@ -165,6 +165,11 @@ Blockly.Comment.prototype.resizeBubble_ = function() {
* @param {boolean} visible True if the bubble should be visible.
*/
Blockly.Comment.prototype.setVisible = function(visible) {
if (!this.block_.workspace.rendered) {
this.rendered = false;
this.visible = visible;
return;
}
if (visible == this.isVisible()) {
// No change.
return;