Minor refactor in alignRowElements currentWidth and desiredWidth computation.

This commit is contained in:
kozbial
2019-08-13 17:15:50 -07:00
parent 99c970bcf5
commit 95163f30de

View File

@@ -537,13 +537,14 @@ Blockly.blockRendering.RenderInfo.prototype.alignRowElements_ = function() {
for (var r = 0; r < this.rows.length; r++) {
var row = this.rows[r];
if (!row.hasInlineInput) {
var currentWidth = row.width;
if (row.hasStatement) {
var statementInput = row.getLastInput();
currentWidth -= statementInput.width;
var currentWidth = row.width - statementInput.width;
var desiredWidth = this.statementEdge - this.startX;
} else {
var currentWidth = row.width;
var desiredWidth = this.width - this.startX;
}
var desiredWidth = row.hasStatement ? this.statementEdge : this.width;
desiredWidth -= this.startX;
if (row.type === 'bottom row' && row.hasFixedWidth) {
desiredWidth = Blockly.blockRendering.constants.MAX_BOTTOM_WIDTH;
}