mirror of
https://github.com/google/blockly.git
synced 2026-01-10 10:27:08 +01:00
Fixes blocks flying when mutator is open (#4289)
This commit is contained in:
@@ -401,15 +401,28 @@ Blockly.Mutator.prototype.workspaceChanged_ = function(e) {
|
||||
var block = this.block_;
|
||||
var oldMutationDom = block.mutationToDom();
|
||||
var oldMutation = oldMutationDom && Blockly.Xml.domToText(oldMutationDom);
|
||||
|
||||
// Switch off rendering while the source block is rebuilt.
|
||||
var savedRendered = block.rendered;
|
||||
// TODO(#4288): We should not be setting the rendered property to false.
|
||||
block.rendered = false;
|
||||
|
||||
// Allow the source block to rebuild itself.
|
||||
block.compose(this.rootBlock_);
|
||||
// Restore rendering and show the changes.
|
||||
block.rendered = savedRendered;
|
||||
// Mutation may have added some elements that need initializing.
|
||||
block.initSvg();
|
||||
block.render();
|
||||
|
||||
if ((/** @type {!Blockly.WorkspaceSvg} */ (Blockly.getMainWorkspace()))
|
||||
.keyboardAccessibilityMode) {
|
||||
Blockly.navigation.moveCursorOnBlockMutation(block);
|
||||
}
|
||||
|
||||
if (block.rendered) {
|
||||
block.render();
|
||||
}
|
||||
|
||||
var newMutationDom = block.mutationToDom();
|
||||
var newMutation = newMutationDom && Blockly.Xml.domToText(newMutationDom);
|
||||
if (oldMutation != newMutation) {
|
||||
|
||||
Reference in New Issue
Block a user