mirror of
https://github.com/google/blockly.git
synced 2026-01-05 08:00:09 +01:00
Fix bad rendering of collapsed function calls.
This commit is contained in:
@@ -273,7 +273,7 @@ Blockly.Blocks['procedures_defnoreturn'] = {
|
||||
if (change) {
|
||||
this.updateParams_();
|
||||
// Update the mutator's variables if the mutator is open.
|
||||
if (this.mutator.isVisible_()) {
|
||||
if (this.mutator.isVisible()) {
|
||||
var blocks = this.mutator.workspace_.getAllBlocks();
|
||||
for (var i = 0, block; block = blocks[i]; i++) {
|
||||
if (block.type == 'procedures_mutatorarg' &&
|
||||
@@ -428,10 +428,9 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
init: function() {
|
||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);
|
||||
this.setColour(Blockly.Blocks.procedures.HUE);
|
||||
this.appendDummyInput()
|
||||
this.appendDummyInput('TOPROW')
|
||||
.appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL)
|
||||
.appendField('', 'NAME')
|
||||
.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
|
||||
.appendField('', 'NAME');
|
||||
this.setPreviousStatement(true);
|
||||
this.setNextStatement(true);
|
||||
// Tooltip is set in domToMutation.
|
||||
@@ -488,6 +487,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
this.quarkArguments_ = null;
|
||||
return;
|
||||
}
|
||||
if (goog.array.equals(this.arguments_, paramNames)) {
|
||||
// No change.
|
||||
this.quarkArguments_ = paramIds;
|
||||
return;
|
||||
}
|
||||
this.setCollapsed(false);
|
||||
if (paramIds.length != paramNames.length) {
|
||||
throw 'Error: paramNames and paramIds must be the same length.';
|
||||
}
|
||||
@@ -536,14 +541,21 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (savedRendered) {
|
||||
input.init();
|
||||
}
|
||||
input.init();
|
||||
}
|
||||
// Add 'with:' if there are parameters.
|
||||
var withField = this.getField_('WITH');
|
||||
if (withField) {
|
||||
withField.setVisible(!!this.arguments_.length);
|
||||
var input = this.getInput('TOPROW');
|
||||
if (input) {
|
||||
if (this.arguments_.length) {
|
||||
if (!this.getField_('WITH')) {
|
||||
input.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
|
||||
input.init();
|
||||
}
|
||||
} else {
|
||||
if (this.getField_('WITH')) {
|
||||
input.removeField('WITH');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore rendering and show the changes.
|
||||
this.rendered = savedRendered;
|
||||
@@ -578,7 +590,7 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
(this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP :
|
||||
Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace('%1', name));
|
||||
var def = Blockly.Procedures.getDefinition(name, this.workspace);
|
||||
if (def && def.mutator.isVisible()) {
|
||||
if (def && def.mutator && def.mutator.isVisible()) {
|
||||
// Initialize caller with the mutator's IDs.
|
||||
this.setProcedureParameters(def.arguments_, def.paramIds_);
|
||||
} else {
|
||||
@@ -634,10 +646,9 @@ Blockly.Blocks['procedures_callreturn'] = {
|
||||
init: function() {
|
||||
this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);
|
||||
this.setColour(Blockly.Blocks.procedures.HUE);
|
||||
this.appendDummyInput()
|
||||
this.appendDummyInput('TOPROW')
|
||||
.appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL)
|
||||
.appendField('', 'NAME')
|
||||
.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
|
||||
.appendField('', 'NAME');
|
||||
this.setOutput(true);
|
||||
// Tooltip is set in domToMutation.
|
||||
this.arguments_ = [];
|
||||
|
||||
Reference in New Issue
Block a user