Merge pull request #2690 from rachel-fenichel/border_rect_default_height

Define BORDER_RECT_DEFAULT_HEIGHT constant
This commit is contained in:
Rachel Fenichel
2019-07-23 16:21:10 -07:00
committed by GitHub
2 changed files with 10 additions and 2 deletions

View File

@@ -117,6 +117,13 @@ Blockly.Field.cacheWidths_ = null;
*/
Blockly.Field.cacheReference_ = 0;
/**
* The default height of the border rect on any field.
* @type {number}
* @package
*/
Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT = 16;
/**
* Name of field. Unique within each block.
* Static labels are usually unnamed.
@@ -278,7 +285,7 @@ Blockly.Field.prototype.createBorderRect_ = function() {
'ry': 4,
'x': -Blockly.BlockSvg.SEP_SPACE_X / 2,
'y': 0,
'height': 16,
'height': Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT,
'width': this.size_.width + Blockly.BlockSvg.SEP_SPACE_X
}, this.fieldGroup_);
};

View File

@@ -437,7 +437,8 @@ Blockly.FieldTextInput.prototype.getCorrectedSize = function() {
// the logic to figure out whether to rerender, just call getSize.
this.getSize();
// TODO (#2562): Remove getCorrectedSize.
return new goog.math.Size(this.size_.width + Blockly.BlockSvg.SEP_SPACE_X, 16);
return new goog.math.Size(this.size_.width + Blockly.BlockSvg.SEP_SPACE_X,
Blockly.Field.BORDER_RECT_DEFAULT_HEIGHT);
};
Blockly.Field.register('field_input', Blockly.FieldTextInput);