Merge pull request #2835 from rachel-fenichel/center_fields

Center some fields and inputs vertically
This commit is contained in:
Rachel Fenichel
2019-08-15 11:24:44 -07:00
committed by GitHub

View File

@@ -678,13 +678,10 @@ Blockly.blockRendering.RenderInfo.prototype.getSpacerRowHeight_ = function(prev,
*/
Blockly.blockRendering.RenderInfo.prototype.getElemCenterline_ = function(row, elem) {
var result = row.yPos;
if (elem.isField()) {
result += (elem.height / 2);
if (row.hasInlineInput || row.hasStatement) {
result += Blockly.blockRendering.constants.TALL_INPUT_FIELD_OFFSET_Y;
}
} else if (elem.isInlineInput()) {
result += elem.height / 2;
if (elem.isField() && row.hasStatement) {
var offset = Blockly.blockRendering.constants.TALL_INPUT_FIELD_OFFSET_Y +
elem.height / 2;
result += offset;
} else if (elem.isNextConnection()) {
result += (row.height - row.overhangY + elem.height / 2);
} else {