Merge pull request #2924 from moniika/moniika-statement-input-alignment

Simplify statement input height computation logic.
This commit is contained in:
Monica Kozbial
2019-08-27 17:29:27 -07:00
committed by GitHub
3 changed files with 5 additions and 8 deletions

View File

@@ -104,9 +104,6 @@ Blockly.BlockSvg.prototype.getHeightWidth = function() {
var nextHeightWidth = nextBlock.getHeightWidth();
height += nextHeightWidth.height - 4; // Height of tab.
width = Math.max(width, nextHeightWidth.width);
} else if (!this.nextConnection && !this.outputConnection) {
// Add a bit of margin under blocks with no bottom tab.
height += 2;
}
return {height: height, width: width};
};

View File

@@ -77,7 +77,7 @@ Blockly.blockRendering.ConstantProvider = function() {
// the left side of the notch.
this.NOTCH_OFFSET_LEFT = 15;
this.STATEMENT_BOTTOM_SPACER = 5;
this.STATEMENT_BOTTOM_SPACER = 0;
this.STATEMENT_INPUT_PADDING_LEFT = 20;
this.BETWEEN_STATEMENT_PADDING_Y = 4;

View File

@@ -118,11 +118,11 @@ Blockly.blockRendering.StatementInput = function(input) {
if (!this.connectedBlock) {
this.height = this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT;
} else {
// We allow the dark path to show on the parent block so that the child
// block looks embossed. This takes up an extra pixel in both x and y.
this.height =
this.connectedBlockHeight + this.constants_.STATEMENT_BOTTOM_SPACER;
if (this.connectedBlock.nextConnection) {
this.height -= this.shape.height;
}
this.connectedBlockHeight + this.constants_.DARK_PATH_OFFSET +
this.constants_.STATEMENT_BOTTOM_SPACER;
}
this.width = this.constants_.NOTCH_OFFSET_LEFT +
this.shape.width;