From ede7c7e125d5cd0c48882b77fbd2e471b21e690f Mon Sep 17 00:00:00 2001 From: Rachel Fenichel Date: Mon, 12 Aug 2019 15:10:57 -0700 Subject: [PATCH] Include tab width in block width --- .../block_rendering_rewrite/block_render_info.js | 12 +++++++++--- .../renderers/block_rendering_rewrite/measurables.js | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/renderers/block_rendering_rewrite/block_render_info.js b/core/renderers/block_rendering_rewrite/block_render_info.js index d96218671..1262e6639 100644 --- a/core/renderers/block_rendering_rewrite/block_render_info.js +++ b/core/renderers/block_rendering_rewrite/block_render_info.js @@ -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; }; /** diff --git a/core/renderers/block_rendering_rewrite/measurables.js b/core/renderers/block_rendering_rewrite/measurables.js index 361fa3363..8cdcd2cfc 100644 --- a/core/renderers/block_rendering_rewrite/measurables.js +++ b/core/renderers/block_rendering_rewrite/measurables.js @@ -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; }