mirror of
https://github.com/google/blockly.git
synced 2026-01-09 18:10:08 +01:00
Update statementInput width to reflect what is actually being rendered.
This commit is contained in:
@@ -487,9 +487,7 @@ Blockly.blockRendering.RenderInfo.prototype.computeBounds_ = function() {
|
||||
for (var r = 0; r < this.rows.length; r++) {
|
||||
var row = this.rows[r];
|
||||
row.measure();
|
||||
if (!row.hasStatement) {
|
||||
blockWidth = Math.max(blockWidth, row.width);
|
||||
}
|
||||
blockWidth = Math.max(blockWidth, row.width);
|
||||
if (row.hasStatement) {
|
||||
var statementInput = row.getLastInput();
|
||||
var innerWidth = row.width - statementInput.width;
|
||||
@@ -502,13 +500,7 @@ Blockly.blockRendering.RenderInfo.prototype.computeBounds_ = function() {
|
||||
|
||||
this.statementEdge = widestStatementRowFields;
|
||||
|
||||
if (widestStatementRowFields) {
|
||||
this.width =
|
||||
Math.max(blockWidth,
|
||||
widestStatementRowFields + Blockly.blockRendering.constants.NOTCH.width * 2);
|
||||
} else {
|
||||
this.width = blockWidth;
|
||||
}
|
||||
this.width = blockWidth;
|
||||
|
||||
for (var r = 0; r < this.rows.length; r++) {
|
||||
var row = this.rows[r];
|
||||
|
||||
@@ -126,11 +126,6 @@ Blockly.blockRendering.constants.EXTERNAL_VALUE_INPUT_PADDING = 2;
|
||||
Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_HEIGHT =
|
||||
Blockly.blockRendering.constants.MIN_BLOCK_HEIGHT;
|
||||
|
||||
Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_WIDTH = 32;
|
||||
|
||||
Blockly.blockRendering.constants.POPULATED_STATEMENT_INPUT_WIDTH = 25;
|
||||
|
||||
|
||||
Blockly.blockRendering.constants.START_POINT = Blockly.utils.svgPaths.moveBy(0, 0);
|
||||
|
||||
/**
|
||||
|
||||
@@ -285,15 +285,14 @@ Blockly.blockRendering.StatementInput = function(input) {
|
||||
|
||||
if (!this.connectedBlock) {
|
||||
this.height = Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_HEIGHT;
|
||||
this.width = Blockly.blockRendering.constants.EMPTY_STATEMENT_INPUT_WIDTH;
|
||||
} else {
|
||||
this.width = Blockly.blockRendering.constants.POPULATED_STATEMENT_INPUT_WIDTH;
|
||||
this.height =
|
||||
this.connectedBlockHeight + Blockly.blockRendering.constants.STATEMENT_BOTTOM_SPACER;
|
||||
if (this.connectedBlock.nextConnection) {
|
||||
this.height -= this.notchShape.height;
|
||||
}
|
||||
}
|
||||
this.width = this.notchShape.width * 2;
|
||||
};
|
||||
goog.inherits(Blockly.blockRendering.StatementInput,
|
||||
Blockly.blockRendering.Input);
|
||||
|
||||
Reference in New Issue
Block a user