mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
Fix collapsed blocks not updating when modified (#3806)
* Stop recursive render calls * Fix visibility bugs. * Make toString ignore collapsed input. * Add automatic collapse rendering handling * Fix insertion markers with collapsed * Add tests * Fix build? * PR comments * Add missing jsdoc
This commit is contained in:
@@ -253,23 +253,25 @@ Blockly.InsertionMarkerManager.prototype.createMarkerBlock_ = function(sourceBlo
|
||||
result.domToMutation(oldMutationDom);
|
||||
}
|
||||
}
|
||||
result.setCollapsed(sourceBlock.isCollapsed());
|
||||
result.setInputsInline(sourceBlock.getInputsInline());
|
||||
// Copy visible field values from the other block. These values may impact
|
||||
// the rendered size of the insertion marker. Note that we do not care
|
||||
// about child blocks here.
|
||||
// Copy field values from the other block. These values may impact the
|
||||
// rendered size of the insertion marker. Note that we do not care about
|
||||
// child blocks here.
|
||||
for (var i = 0; i < sourceBlock.inputList.length; i++) {
|
||||
var sourceInput = sourceBlock.inputList[i];
|
||||
if (sourceInput.isVisible()) {
|
||||
var resultInput = result.inputList[i];
|
||||
for (var j = 0; j < sourceInput.fieldRow.length; j++) {
|
||||
var sourceField = sourceInput.fieldRow[j];
|
||||
var resultField = resultInput.fieldRow[j];
|
||||
resultField.setValue(sourceField.getValue());
|
||||
}
|
||||
if (sourceInput.name == Blockly.Block.COLLAPSED_INPUT_NAME) {
|
||||
continue; // Ignore the collapsed input.
|
||||
}
|
||||
var resultInput = result.inputList[i];
|
||||
for (var j = 0; j < sourceInput.fieldRow.length; j++) {
|
||||
var sourceField = sourceInput.fieldRow[j];
|
||||
var resultField = resultInput.fieldRow[j];
|
||||
resultField.setValue(sourceField.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
result.setCollapsed(sourceBlock.isCollapsed());
|
||||
result.setInputsInline(sourceBlock.getInputsInline());
|
||||
|
||||
result.initSvg();
|
||||
result.getSvgRoot().setAttribute('visibility', 'hidden');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user