Fix value to stack width measurement (#3559)

* Include width of connected block in value to stack width measurement.
This commit is contained in:
Sam El-Husseini
2020-01-07 16:05:34 -08:00
committed by GitHub
parent 7ac83a318b
commit c3867443f5
3 changed files with 23 additions and 0 deletions

View File

@@ -754,6 +754,13 @@ Blockly.blockRendering.RenderInfo.prototype.finalize_ = function() {
Math.max(widestRowWithConnectedBlocks, row.widthWithConnectedBlocks);
this.recordElemPositions_(row);
}
if (this.outputConnection && this.block_.nextConnection &&
this.block_.nextConnection.isConnected()) {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks =
Math.max(widestRowWithConnectedBlocks,
this.block_.nextConnection.targetBlock().getHeightWidth().width);
}
this.widthWithChildren = Math.max(this.widthWithChildren,
widestRowWithConnectedBlocks + this.startX);

View File

@@ -403,6 +403,15 @@ Blockly.geras.RenderInfo.prototype.finalize_ = function() {
}
this.recordElemPositions_(row);
}
if (this.outputConnection && this.block_.nextConnection &&
this.block_.nextConnection.isConnected()) {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks =
Math.max(widestRowWithConnectedBlocks,
this.block_.nextConnection.targetBlock().getHeightWidth().width -
this.constants_.DARK_PATH_OFFSET);
}
this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;
// The dark (lowlight) adds to the size of the block in both x and y.

View File

@@ -329,6 +329,13 @@ Blockly.thrasos.RenderInfo.prototype.finalize_ = function() {
}
this.recordElemPositions_(row);
}
if (this.outputConnection && this.block_.nextConnection &&
this.block_.nextConnection.isConnected()) {
// Include width of connected block in value to stack width measurement.
widestRowWithConnectedBlocks =
Math.max(widestRowWithConnectedBlocks,
this.block_.nextConnection.targetBlock().getHeightWidth().width);
}
this.bottomRow.baseline = yCursor - this.bottomRow.descenderHeight;
this.widthWithChildren = widestRowWithConnectedBlocks + this.startX;