Include tab width in block width

This commit is contained in:
Rachel Fenichel
2019-08-12 15:10:57 -07:00
parent 5b955f6bbe
commit ede7c7e125
2 changed files with 9 additions and 4 deletions

View File

@@ -120,7 +120,7 @@ Blockly.blockRendering.RenderInfo = function(block) {
// The position of the start point for drawing, relative to the block's
// location.
this.startX = 10;
this.startX = 0;
this.startY = 0;
this.measure_();
@@ -519,6 +519,12 @@ Blockly.blockRendering.RenderInfo.prototype.computeBounds_ = function() {
this.widthWithChildren =
Math.max(blockWidth, widestRowWithConnectedBlocks);
if (this.outputConnection) {
this.startX = this.outputConnection.width;
this.width += this.outputConnection.width;
this.widthWithChildren += this.outputConnection.width;
}
};
/**
@@ -532,7 +538,7 @@ Blockly.blockRendering.RenderInfo.prototype.alignRowElements_ = function() {
var row = this.rows[r];
if (!row.hasStatement && !row.hasInlineInput) {
var currentWidth = row.width;
var desiredWidth = this.width;
var desiredWidth = this.width - this.startX;
if (row.type === 'bottom row' && row.hasFixedWidth) {
desiredWidth = Blockly.blockRendering.constants.MAX_BOTTOM_WIDTH;
}
@@ -630,7 +636,7 @@ Blockly.blockRendering.RenderInfo.prototype.getSpacerRowWidth_ = function(prev,
if (next.type === 'bottom row' && next.hasFixedWidth) {
return next.width;
}
return this.width;
return this.width - this.startX;
};
/**

View File

@@ -260,7 +260,6 @@ Blockly.blockRendering.InlineInput = function(input) {
// 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.width = this.connectedBlockWidth +
this.connectionShape.width +
Blockly.blockRendering.constants.DARK_PATH_OFFSET;
this.height = this.connectedBlockHeight + Blockly.blockRendering.constants.DARK_PATH_OFFSET;
}