Use connection width to find empty input width

This commit is contained in:
Rachel Fenichel
2019-08-12 15:51:41 -07:00
parent d954182c41
commit 71e720444f
2 changed files with 6 additions and 5 deletions

View File

@@ -108,13 +108,12 @@ Blockly.blockRendering.constants.SPACER_DEFAULT_HEIGHT = 15;
Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT = 24;
Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_WIDTH =
Blockly.blockRendering.constants.TAB_WIDTH + 14.5;
Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_PADDING = 14.5;
Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_HEIGHT =
Blockly.blockRendering.constants.TAB_HEIGHT + 11;
Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_WIDTH = 10;
Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_PADDING = 2;
/**
* The height of an empty statement input. Note that in the old rendering this

View File

@@ -255,7 +255,8 @@ Blockly.blockRendering.InlineInput = function(input) {
if (!this.connectedBlock) {
this.height = Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_HEIGHT;
this.width = Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_WIDTH;
this.width = this.connectionShape.width +
Blockly.blockRendering.constants.EMPTY_INLINE_INPUT_PADDING;
} 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.
@@ -315,7 +316,8 @@ Blockly.blockRendering.ExternalValueInput = function(input) {
this.height =
this.connectedBlockHeight - 2 * Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP;
}
this.width = Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_WIDTH;
this.width = this.connectionShape.width +
Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_PADDING;
this.connectionOffsetY = Blockly.blockRendering.constants.TAB_OFFSET_FROM_TOP;
this.connectionHeight = this.connectionShape.height;