mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
Break out procedure call argument rendering into separate function.
This commit is contained in:
@@ -526,13 +526,12 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
}
|
||||
// Rebuild the block's arguments.
|
||||
this.arguments_ = [].concat(paramNames);
|
||||
this.renderArgs_();
|
||||
this.quarkArguments_ = paramIds;
|
||||
for (var i = 0; i < this.arguments_.length; i++) {
|
||||
var input = this.appendValueInput('ARG' + i)
|
||||
.setAlign(Blockly.ALIGN_RIGHT)
|
||||
.appendField(this.arguments_[i]);
|
||||
if (this.quarkArguments_) {
|
||||
// Reconnect any child blocks.
|
||||
// Reconnect any child blocks.
|
||||
if (this.quarkArguments_) {
|
||||
for (var i = 0; i < this.arguments_.length; i++) {
|
||||
var input = this.getInput('ARG' + i);
|
||||
var quarkName = this.quarkArguments_[i];
|
||||
if (quarkName in this.quarkConnections_) {
|
||||
var connection = this.quarkConnections_[quarkName];
|
||||
@@ -545,6 +544,23 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore rendering and show the changes.
|
||||
this.rendered = savedRendered;
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Render the arguments.
|
||||
* @this Blockly.Block
|
||||
* @private
|
||||
*/
|
||||
renderArgs_: function() {
|
||||
for (var i = 0; i < this.arguments_.length; i++) {
|
||||
var input = this.appendValueInput('ARG' + i)
|
||||
.setAlign(Blockly.ALIGN_RIGHT)
|
||||
.appendField(this.arguments_[i]);
|
||||
input.init();
|
||||
}
|
||||
// Add 'with:' if there are parameters.
|
||||
@@ -561,11 +577,6 @@ Blockly.Blocks['procedures_callnoreturn'] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Restore rendering and show the changes.
|
||||
this.rendered = savedRendered;
|
||||
if (this.rendered) {
|
||||
this.render();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Create XML to represent the (non-editable) name and arguments.
|
||||
@@ -663,6 +674,7 @@ Blockly.Blocks['procedures_callreturn'] = {
|
||||
renameProcedure: Blockly.Blocks['procedures_callnoreturn'].renameProcedure,
|
||||
setProcedureParameters:
|
||||
Blockly.Blocks['procedures_callnoreturn'].setProcedureParameters,
|
||||
renderArgs_: Blockly.Blocks['procedures_callnoreturn'].renderArgs_,
|
||||
mutationToDom: Blockly.Blocks['procedures_callnoreturn'].mutationToDom,
|
||||
domToMutation: Blockly.Blocks['procedures_callnoreturn'].domToMutation,
|
||||
renameVar: Blockly.Blocks['procedures_callnoreturn'].renameVar,
|
||||
|
||||
Reference in New Issue
Block a user