Adjust what the spacers at after the top and before the bottom rows depend on. Make them depend on the top row's minHeight and desired height. (#3686)

This commit is contained in:
Sam El-Husseini
2020-02-10 08:58:08 -08:00
committed by GitHub
parent 55241d7d96
commit 33e082414d
2 changed files with 14 additions and 7 deletions

View File

@@ -109,7 +109,7 @@ Blockly.zelos.ConstantProvider = function() {
/**
* @override
*/
this.TOP_ROW_MIN_HEIGHT = this.GRID_UNIT;
this.TOP_ROW_MIN_HEIGHT = this.CORNER_RADIUS;
/**
* @override
@@ -119,7 +119,7 @@ Blockly.zelos.ConstantProvider = function() {
/**
* @override
*/
this.BOTTOM_ROW_MIN_HEIGHT = this.GRID_UNIT;
this.BOTTOM_ROW_MIN_HEIGHT = this.CORNER_RADIUS;
/**
* @override

View File

@@ -212,21 +212,28 @@ Blockly.zelos.RenderInfo.prototype.getSpacerRowHeight_ = function(
Blockly.blockRendering.Types.isInputRow(next) && next.hasStatement;
if (precedesStatement || followsStatement) {
var cornerHeight = this.constants_.INSIDE_CORNERS.rightHeight || 0;
var height = Math.max(this.constants_.MEDIUM_PADDING,
Math.max(this.constants_.NOTCH_HEIGHT, cornerHeight));
var height = Math.max(this.constants_.NOTCH_HEIGHT, cornerHeight);
return precedesStatement && followsStatement ?
Math.max(height, this.constants_.DUMMY_INPUT_MIN_HEIGHT) : height;
}
// Top and bottom rows act as a spacer so we don't need any extra padding.
if ((Blockly.blockRendering.Types.isTopRow(prev))) {
if (!prev.hasPreviousConnection && !this.outputConnection) {
return this.constants_.SMALL_PADDING;
if (!prev.hasPreviousConnection &&
(!this.outputConnection || this.hasStatementInput)) {
return Math.abs(this.constants_.NOTCH_HEIGHT -
this.constants_.CORNER_RADIUS);
}
return this.constants_.NO_PADDING;
}
if ((Blockly.blockRendering.Types.isBottomRow(next))) {
if (!this.outputConnection) {
return this.constants_.SMALL_PADDING;
var topHeight = Math.max(this.topRow.minHeight,
Math.max(this.constants_.NOTCH_HEIGHT,
this.constants_.CORNER_RADIUS)) - this.constants_.CORNER_RADIUS;
return topHeight;
} else if (!next.hasNextConnection && this.hasStatementInput) {
return Math.abs(this.constants_.NOTCH_HEIGHT -
this.constants_.CORNER_RADIUS);
}
return this.constants_.NO_PADDING;
}