mirror of
https://github.com/google/blockly.git
synced 2026-01-11 02:47:09 +01:00
Make checkbox field width a constant. (#3499)
This commit is contained in:
@@ -60,9 +60,6 @@ Blockly.FieldCheckbox = function(opt_value, opt_validator, opt_config) {
|
||||
}
|
||||
Blockly.FieldCheckbox.superClass_.constructor.call(
|
||||
this, opt_value, opt_validator, opt_config);
|
||||
|
||||
this.size_.width = Blockly.FieldCheckbox.WIDTH;
|
||||
|
||||
};
|
||||
Blockly.utils.object.inherits(Blockly.FieldCheckbox, Blockly.Field);
|
||||
|
||||
@@ -77,13 +74,6 @@ Blockly.FieldCheckbox.fromJson = function(options) {
|
||||
return new Blockly.FieldCheckbox(options['checked'], undefined, options);
|
||||
};
|
||||
|
||||
/**
|
||||
* The width of a checkbox field.
|
||||
* @type {number}
|
||||
* @const
|
||||
*/
|
||||
Blockly.FieldCheckbox.WIDTH = 15;
|
||||
|
||||
/**
|
||||
* Default character for the checkmark.
|
||||
* @type {string}
|
||||
@@ -129,6 +119,7 @@ Blockly.FieldCheckbox.prototype.configure_ = function(config) {
|
||||
* @package
|
||||
*/
|
||||
Blockly.FieldCheckbox.prototype.initView = function() {
|
||||
this.size_.width = this.constants_.FIELD_CHECKBOX_DEFAULT_WIDTH;
|
||||
Blockly.FieldCheckbox.superClass_.initView.call(this);
|
||||
|
||||
this.textElement_.setAttribute('x', this.constants_.FIELD_CHECKBOX_X_OFFSET);
|
||||
|
||||
@@ -360,6 +360,12 @@ Blockly.blockRendering.ConstantProvider = function() {
|
||||
*/
|
||||
this.FIELD_CHECKBOX_Y_OFFSET = 14;
|
||||
|
||||
/**
|
||||
* A checkbox field's default width.
|
||||
* @type {number}
|
||||
*/
|
||||
this.FIELD_CHECKBOX_DEFAULT_WIDTH = 15;
|
||||
|
||||
/**
|
||||
* The ID of the emboss filter, or the empty string if no filter is set.
|
||||
* @type {string}
|
||||
|
||||
@@ -318,6 +318,21 @@ Blockly.zelos.ConstantProvider = function() {
|
||||
*/
|
||||
this.FIELD_COLOUR_DEFAULT_HEIGHT = 4 * this.GRID_UNIT;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
this.FIELD_CHECKBOX_X_OFFSET = this.FIELD_BORDER_RECT_X_PADDING - 3;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
this.FIELD_CHECKBOX_Y_OFFSET = 22;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
this.FIELD_CHECKBOX_DEFAULT_WIDTH = 6 * this.GRID_UNIT;
|
||||
|
||||
/**
|
||||
* The ID of the highlight glow filter, or the empty string if no filter is
|
||||
* set.
|
||||
|
||||
Reference in New Issue
Block a user