From e35f4d507009ff50a08299d4995c284fbd90f966 Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Wed, 4 Sep 2019 15:08:38 -0700 Subject: [PATCH] More cleanup. --- core/renderers/geras/highlighter.js | 8 +++----- core/renderers/geras/info.js | 2 -- core/renderers/measurables/rows.js | 11 ++++++++++- core/renderers/thrasos/info.js | 2 -- core/renderers/zelos/info.js | 9 +-------- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/core/renderers/geras/highlighter.js b/core/renderers/geras/highlighter.js index 9f5c50799..54b4ade19 100644 --- a/core/renderers/geras/highlighter.js +++ b/core/renderers/geras/highlighter.js @@ -172,21 +172,19 @@ Blockly.geras.Highlighter.prototype.drawRightSideRow = function(row) { }; Blockly.geras.Highlighter.prototype.drawBottomRow = function(row) { - var baseline = row.baseline; - // Highlight the vertical edge of the bottom row on the input side. // Highlighting is always from the top left, both in LTR and RTL. if (this.RTL_) { - this.steps_.push('V', baseline - this.highlightOffset_); + this.steps_.push('V', row.baseline - this.highlightOffset_); } else { var cornerElem = this.info_.bottomRow.elements[0]; if (Blockly.blockRendering.Types.isLeftSquareCorner(cornerElem)) { this.steps_.push( Blockly.utils.svgPaths.moveTo( row.xPos + this.highlightOffset_, - baseline - this.highlightOffset_)); + row.baseline - this.highlightOffset_)); } else if (Blockly.blockRendering.Types.isLeftRoundedCorner(cornerElem)) { - this.steps_.push(Blockly.utils.svgPaths.moveTo(row.xPos, baseline)); + this.steps_.push(Blockly.utils.svgPaths.moveTo(row.xPos, row.baseline)); this.steps_.push(this.outsideCornerPaths_.bottomLeft()); } } diff --git a/core/renderers/geras/info.js b/core/renderers/geras/info.js index 49a8c02ab..2deb28a0d 100644 --- a/core/renderers/geras/info.js +++ b/core/renderers/geras/info.js @@ -319,8 +319,6 @@ Blockly.geras.RenderInfo.prototype.getElemCenterline_ = function(row, elem) { } } else if (Blockly.blockRendering.Types.isInlineInput(elem)) { result += elem.height / 2; - } else if (Blockly.blockRendering.Types.isNextConnection(elem)) { - result += (row.height - row.descenderHeight + elem.height / 2); } else { result += (row.height / 2); } diff --git a/core/renderers/measurables/rows.js b/core/renderers/measurables/rows.js index 65066f408..96936a0a3 100644 --- a/core/renderers/measurables/rows.js +++ b/core/renderers/measurables/rows.js @@ -222,13 +222,17 @@ Blockly.blockRendering.TopRow = function() { /** * The starting point for drawing the row, in the y direction. - * This allows us to draw hats and simliar shapes that don't start at the + * This allows us to draw hats and similar shapes that don't start at the * origin. Must be non-negative (see #2820). * @package * @type {number} */ this.capline = 0; + /** + * How much the row extends up above its capline. + * @type {number} + */ this.ascenderHeight = 0; /** @@ -356,6 +360,11 @@ Blockly.blockRendering.BottomRow = function() { */ this.descenderHeight = 0; + /** + * The Y position of the bottom edge of the block, relative to the origin + * of the block rendering. + * @type {number} + */ this.baseline = 0; }; goog.inherits(Blockly.blockRendering.BottomRow, Blockly.blockRendering.Row); diff --git a/core/renderers/thrasos/info.js b/core/renderers/thrasos/info.js index 7d46bd555..9a4c62621 100644 --- a/core/renderers/thrasos/info.js +++ b/core/renderers/thrasos/info.js @@ -316,8 +316,6 @@ Blockly.thrasos.RenderInfo.prototype.getElemCenterline_ = function(row, elem) { var offset = this.constants_.TALL_INPUT_FIELD_OFFSET_Y + elem.height / 2; result += offset; - } else if (Blockly.blockRendering.Types.isNextConnection(elem)) { - result += (row.height - row.descenderHeight + elem.height / 2); } else { result += (row.height / 2); } diff --git a/core/renderers/zelos/info.js b/core/renderers/zelos/info.js index 33d54791e..4f91fffde 100644 --- a/core/renderers/zelos/info.js +++ b/core/renderers/zelos/info.js @@ -301,14 +301,7 @@ Blockly.zelos.RenderInfo.prototype.getElemCenterline_ = function(row, } return row.capline + elem.height / 2; } - - var result = row.yPos; - if (Blockly.blockRendering.Types.isNextConnection(elem)) { - result += (row.height - row.descenderHeight + elem.height / 2); - } else { - result += (row.height / 2); - } - return result; + return row.yPos + row.height / 2; }; /**