updateVariableName -> refreshVariableName

This commit is contained in:
Beka Westberg
2019-07-26 12:55:43 -07:00
parent a5bc29357f
commit 3d813803ca
2 changed files with 5 additions and 4 deletions

View File

@@ -1078,7 +1078,7 @@ Blockly.Block.prototype.updateVarName = function(variable) {
for (var j = 0, field; field = input.fieldRow[j]; j++) {
if (field.referencesVariables() &&
variable.getId() == field.getValue()) {
field.updateVariableName();
field.refreshVariableName();
}
}
}

View File

@@ -342,11 +342,12 @@ Blockly.FieldVariable.prototype.setTypes_ = function(opt_variableTypes,
};
/**
* A callback to update the name of a variable. Should only be called by
* the block.
* Refreshes the name of the variable by grabbing the name of the model.
* Used when a variable gets renamed, but the ID stays the same. Should only
* be called by the block.
* @package
*/
Blockly.FieldVariable.prototype.updateVariableName = function() {
Blockly.FieldVariable.prototype.refreshVariableName = function() {
this.text_ = this.variable_.name;
this.forceRerender();
};