Statement inputs have minimum widths. (#3463)

This commit is contained in:
Sam El-Husseini
2019-11-22 13:53:49 -08:00
committed by GitHub
parent 2a8e7d9ac8
commit 30a49c3225
3 changed files with 10 additions and 4 deletions

View File

@@ -184,9 +184,9 @@ Blockly.blockRendering.RenderInfo.prototype.getRenderer = function() {
Blockly.blockRendering.RenderInfo.prototype.measure = function() {
this.createRows_();
this.addElemSpacing_();
this.addRowSpacing_();
this.computeBounds_();
this.alignRowElements_();
this.addRowSpacing_();
this.finalize_();
};

View File

@@ -115,7 +115,7 @@ Blockly.zelos.ConstantProvider = function() {
* Minimum statement input spacer width.
* @type {number}
*/
this.STATEMENT_INPUT_SPACER_MIN_WIDTH = 30 * this.GRID_UNIT;
this.STATEMENT_INPUT_SPACER_MIN_WIDTH = 34.5 * this.GRID_UNIT;
/**
* @override

View File

@@ -120,6 +120,12 @@ Blockly.zelos.RenderInfo.prototype.getInRowSpacing_ = function(prev, next) {
return this.constants_.NO_PADDING;
}
}
if (!prev) {
// Statement input padding.
if (next && Blockly.blockRendering.Types.isStatementInput(next)) {
return this.constants_.STATEMENT_INPUT_PADDING_LEFT;
}
}
// 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) ||
@@ -141,13 +147,13 @@ Blockly.zelos.RenderInfo.prototype.makeSpacerRow_ = function(prev, next) {
new Blockly.zelos.BeforeStatementSpacerRow(
this.constants_,
Math.max(height, this.constants_.INSIDE_CORNERS.rightHeight || 0),
width);
Math.max(width, this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH));
} else if (Blockly.blockRendering.Types.isInputRow(prev) && prev.hasStatement) {
var spacer =
new Blockly.zelos.AfterStatementSpacerRow(
this.constants_,
Math.max(height, this.constants_.INSIDE_CORNERS.rightHeight || 0),
width);
Math.max(width, this.constants_.STATEMENT_INPUT_SPACER_MIN_WIDTH));
} else {
var spacer = new Blockly.blockRendering.SpacerRow(
this.constants_, height, width);