diff --git a/core/renderers/common/info.js b/core/renderers/common/info.js index ca1f50923..8357b6c0a 100644 --- a/core/renderers/common/info.js +++ b/core/renderers/common/info.js @@ -262,8 +262,9 @@ Blockly.blockRendering.RenderInfo.prototype.shouldStartNewRow_ = function(input, if (!lastInput) { return false; } - // A statement input always gets a new row. - if (input.type == Blockly.NEXT_STATEMENT) { + // A statement input or an input following one always gets a new row. + if (input.type == Blockly.NEXT_STATEMENT || + lastInput.type == Blockly.NEXT_STATEMENT) { return true; } // Value and dummy inputs get new row if inputs are not inlined. @@ -371,18 +372,15 @@ Blockly.blockRendering.RenderInfo.prototype.computeBounds_ = function() { */ Blockly.blockRendering.RenderInfo.prototype.alignRowElements_ = function() { for (var i = 0, row; (row = this.rows[i]); i++) { - // TODO (#2921): this still doesn't handle the row having an inline input. - if (!row.hasInlineInput) { - if (row.hasStatement) { - this.alignStatementRow_( - /** @type {Blockly.RenderedConnection} */ (row)); - } else { - var currentWidth = row.width; - var desiredWidth = this.width - this.startX; - var missingSpace = desiredWidth - currentWidth; - if (missingSpace) { - this.addAlignmentPadding_(row, missingSpace); - } + if (row.hasStatement) { + this.alignStatementRow_( + /** @type {Blockly.RenderedConnection} */ (row)); + } else { + var currentWidth = row.width; + var desiredWidth = this.width - this.startX; + var missingSpace = desiredWidth - currentWidth; + if (missingSpace) { + this.addAlignmentPadding_(row, missingSpace); } } } diff --git a/core/renderers/geras/info.js b/core/renderers/geras/info.js index 7f9c89991..e2591a62f 100644 --- a/core/renderers/geras/info.js +++ b/core/renderers/geras/info.js @@ -64,26 +64,6 @@ Blockly.geras.RenderInfo = function(block) { Blockly.utils.object.inherits(Blockly.geras.RenderInfo, Blockly.blockRendering.RenderInfo); -/** - * @override - */ -Blockly.geras.RenderInfo.prototype.shouldStartNewRow_ = function(input, lastInput) { - // If this is the first input, just add to the existing row. - // That row is either empty or has some icons in it. - if (!lastInput) { - return false; - } - // A statement input always gets a new row. - if (input.type == Blockly.NEXT_STATEMENT) { - return true; - } - // Value and dummy inputs get new row if inputs are not inlined. - if (input.type == Blockly.INPUT_VALUE || input.type == Blockly.DUMMY_INPUT) { - return !this.isInline; - } - return false; -}; - /** * @override */ @@ -286,7 +266,7 @@ Blockly.geras.RenderInfo.prototype.getSpacerRowHeight_ = function(prev, next) { if (prev.hasStatement && next.hasStatement) { return this.constants_.LARGE_PADDING; } - if (next.hasDummyInput) { + if (!prev.hasStatement && next.hasDummyInput) { return this.constants_.LARGE_PADDING; } return this.constants_.MEDIUM_PADDING; diff --git a/core/renderers/thrasos/info.js b/core/renderers/thrasos/info.js index 44e3a3d59..71d6c97a5 100644 --- a/core/renderers/thrasos/info.js +++ b/core/renderers/thrasos/info.js @@ -64,26 +64,6 @@ Blockly.thrasos.RenderInfo = function(block) { Blockly.utils.object.inherits(Blockly.thrasos.RenderInfo, Blockly.blockRendering.RenderInfo); -/** - * @override - */ -Blockly.thrasos.RenderInfo.prototype.shouldStartNewRow_ = function(input, lastInput) { - // If this is the first input, just add to the existing row. - // That row is either empty or has some icons in it. - if (!lastInput) { - return false; - } - // A statement input always gets a new row. - if (input.type == Blockly.NEXT_STATEMENT) { - return true; - } - // Value and dummy inputs get new row if inputs are not inlined. - if (input.type == Blockly.INPUT_VALUE || input.type == Blockly.DUMMY_INPUT) { - return !this.isInline; - } - return false; -}; - /** * @override */