From 38e2b9d3ca2795a07a900c2c9cb9c50f88b24af1 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Sun, 15 Dec 2019 02:34:58 -0800 Subject: [PATCH] [zelos] Statement input centreline (#3513) * Make statement inputs in zelos use the top row centreline. --- core/renderers/zelos/constants.js | 5 +++++ core/renderers/zelos/info.js | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/core/renderers/zelos/constants.js b/core/renderers/zelos/constants.js index 949f990fc..db4c2bc8c 100644 --- a/core/renderers/zelos/constants.js +++ b/core/renderers/zelos/constants.js @@ -96,6 +96,11 @@ Blockly.zelos.ConstantProvider = function() { */ this.MIN_BLOCK_HEIGHT = 12 * this.GRID_UNIT; + /** + * @override + */ + this.EMPTY_STATEMENT_INPUT_HEIGHT = 6 * this.GRID_UNIT; + /** * @override */ diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index 580fc3fe2..aea66f2cc 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -221,6 +221,17 @@ Blockly.zelos.RenderInfo.prototype.getSpacerRowWidth_ = function(prev, next) { return width; }; +/** + * @override + */ +Blockly.zelos.RenderInfo.prototype.getElemCenterline_ = function(row, elem) { + if (row.hasStatement) { + return row.yPos + this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT / 2; + } + return Blockly.zelos.RenderInfo.superClass_.getElemCenterline_.call(this, + row, elem); +}; + /** * Adjust the x position of fields to bump all non-label fields in the first row * past the notch position. This must be called before ``computeBounds`` is