From d11b7228c2318f5bb4e7e442719298e61e9d26c9 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 21 Oct 2019 17:21:44 -0700 Subject: [PATCH] Fix #3228 by only using the dark path offset in Geras. --- core/renderers/common/info.js | 2 +- core/renderers/geras/info.js | 22 ++++++++++++++++++++++ core/renderers/measurables/inputs.js | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/renderers/common/info.js b/core/renderers/common/info.js index 4e2915ba0..62841a838 100644 --- a/core/renderers/common/info.js +++ b/core/renderers/common/info.js @@ -309,7 +309,7 @@ Blockly.blockRendering.RenderInfo.prototype.populateBottomRow_ = function() { if (followsStatement) { this.bottomRow.minHeight = this.constants_.LARGE_PADDING; } else { - this.bottomRow.minHeight = this.constants_.MEDIUM_PADDING - 1; + this.bottomRow.minHeight = this.constants_.MEDIUM_PADDING; } var leftSquareCorner = this.bottomRow.hasLeftSquareCorner(this.block_); diff --git a/core/renderers/geras/info.js b/core/renderers/geras/info.js index 90f1d8238..31b99e6b7 100644 --- a/core/renderers/geras/info.js +++ b/core/renderers/geras/info.js @@ -73,6 +73,28 @@ Blockly.geras.RenderInfo.prototype.getRenderer = function() { return /** @type {!Blockly.geras.Renderer} */ (this.renderer_); }; +/** + * @override + */ +Blockly.geras.RenderInfo.prototype.populateBottomRow_ = function() { + Blockly.geras.RenderInfo.superClass_.populateBottomRow_.call(this); + + var followsStatement = + this.block_.inputList.length && + this.block_.inputList[this.block_.inputList.length - 1] + .type == Blockly.NEXT_STATEMENT; + + // The minimum height of the bottom row is smaller in Geras than in other + // renderers, because the dark path adds a pixel. + // If one of the row's elements has a greater height this will be overwritten + // in the compute pass. + if (!followsStatement) { + this.bottomRow.minHeight = + this.constants_.MEDIUM_PADDING - this.constants_.DARK_PATH_OFFSET; + } + +}; + /** * @override */ diff --git a/core/renderers/measurables/inputs.js b/core/renderers/measurables/inputs.js index 2d44fd02b..90e6706fb 100644 --- a/core/renderers/measurables/inputs.js +++ b/core/renderers/measurables/inputs.js @@ -154,7 +154,8 @@ Blockly.blockRendering.ExternalValueInput = function(constants, input) { this.height = this.shape.height; } else { this.height = - this.connectedBlockHeight - 2 * this.constants_.TAB_OFFSET_FROM_TOP; + this.connectedBlockHeight - this.constants_.TAB_OFFSET_FROM_TOP - + this.constants_.MEDIUM_PADDING; } this.width = this.shape.width + this.constants_.EXTERNAL_VALUE_INPUT_PADDING;