diff --git a/core/renderers/common/constants.js b/core/renderers/common/constants.js index cc1bf6edb..9bd0f20a4 100644 --- a/core/renderers/common/constants.js +++ b/core/renderers/common/constants.js @@ -82,8 +82,29 @@ Blockly.blockRendering.ConstantProvider = function() { this.STATEMENT_INPUT_PADDING_LEFT = 20; this.BETWEEN_STATEMENT_PADDING_Y = 4; - // The minimum height of the bottom row following a statement input. - this.AFTER_STATEMENT_BOTTOM_ROW_MIN_HEIGHT = this.LARGE_PADDING; + /** + * The top row's minimum height. + * @type {number} + */ + this.TOP_ROW_MIN_HEIGHT = this.MEDIUM_PADDING; + + /** + * The top row's minimum height if it precedes a statement. + * @type {number} + */ + this.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING; + + /** + * The bottom row's minimum height. + * @type {number} + */ + this.BOTTOM_ROW_MIN_HEIGHT = this.MEDIUM_PADDING; + + /** + * The bottom row's minimum height if it follows a statement input. + * @type {number} + */ + this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT = this.LARGE_PADDING; // This is the max width of a bottom row that follows a statement input and // has inputs inline. diff --git a/core/renderers/common/info.js b/core/renderers/common/info.js index 8ebe44a0c..6a41b470d 100644 --- a/core/renderers/common/info.js +++ b/core/renderers/common/info.js @@ -286,9 +286,10 @@ Blockly.blockRendering.RenderInfo.prototype.populateTopRow_ = function() { // This is the minimum height for the row. If one of its elements has a // greater height it will be overwritten in the compute pass. if (precedesStatement && !this.block_.isCollapsed()) { - this.topRow.minHeight = this.constants_.LARGE_PADDING; + this.topRow.minHeight = + this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT; } else { - this.topRow.minHeight = this.constants_.MEDIUM_PADDING; + this.topRow.minHeight = this.constants_.TOP_ROW_MIN_HEIGHT; } var rightSquareCorner = this.topRow.hasRightSquareCorner(this.block_); @@ -318,9 +319,9 @@ Blockly.blockRendering.RenderInfo.prototype.populateBottomRow_ = function() { // greater height it will be overwritten in the compute pass. if (followsStatement) { this.bottomRow.minHeight = - this.constants_.AFTER_STATEMENT_BOTTOM_ROW_MIN_HEIGHT; + this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT; } else { - this.bottomRow.minHeight = this.constants_.MEDIUM_PADDING; + this.bottomRow.minHeight = this.constants_.BOTTOM_ROW_MIN_HEIGHT; } var leftSquareCorner = this.bottomRow.hasLeftSquareCorner(this.block_); diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index 9b1c980a9..ea12bad23 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -91,6 +91,21 @@ Blockly.zelos.ConstantProvider = function() { */ this.TAB_OFFSET_FROM_TOP = 0; + /** + * @override + */ + this.TOP_ROW_MIN_HEIGHT = this.GRID_UNIT; + + /** + * @override + */ + this.BOTTOM_ROW_MIN_HEIGHT = this.GRID_UNIT; + + /** + * @override + */ + this.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT = 7 * this.GRID_UNIT; + /** * @override */ @@ -107,11 +122,6 @@ Blockly.zelos.ConstantProvider = function() { */ this.STATEMENT_INPUT_PADDING_LEFT = 4 * this.GRID_UNIT; - /** - * @override - */ - this.AFTER_STATEMENT_BOTTOM_ROW_MIN_HEIGHT = 7 * this.GRID_UNIT; - /** * @override */ diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index 4060fbdbb..4a124580f 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -109,6 +109,27 @@ Blockly.zelos.RenderInfo.prototype.computeBounds_ = function() { } }; +/** + * @override + */ +Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) { + if (!prev || !next) { + // No need for padding at the beginning or end of the row if the + // output shape is dynamic. + if (this.outputConnection && this.outputConnection.isDynamicShape) { + return this.constants_.NO_PADDING; + } + } + // Spacing between a rounded corner and a previous or next connection. + if (prev && Blockly.blockRendering.Types.isLeftRoundedCorner(prev) && next) { + if (Blockly.blockRendering.Types.isPreviousConnection(next) || + Blockly.blockRendering.Types.isNextConnection(next)) { + return next.notchOffset - this.constants_.CORNER_RADIUS; + } + } + return this.constants_.MEDIUM_PADDING; +}; + /** * @override */ diff --git a/tests/rendering/zelos/zelos.html b/tests/rendering/zelos/zelos.html index d1fd73706..7aa679e2c 100644 --- a/tests/rendering/zelos/zelos.html +++ b/tests/rendering/zelos/zelos.html @@ -32,9 +32,6 @@