Allow checkmark customization.

Issue 295.
This commit is contained in:
Neil Fraser
2016-03-24 17:18:21 -07:00
parent ad37d69af9
commit 4585e21d9f

View File

@@ -46,6 +46,11 @@ Blockly.FieldCheckbox = function(state, opt_validator) {
};
goog.inherits(Blockly.FieldCheckbox, Blockly.Field);
/**
* Character for the checkmark.
*/
Blockly.FieldCheckbox.CHECK_CHAR = '\u2713';
/**
* Mouse cursor style when over the hotspot that initiates editability.
*/
@@ -64,8 +69,9 @@ Blockly.FieldCheckbox.prototype.init = function(block) {
// The checkbox doesn't use the inherited text element.
// Instead it uses a custom checkmark element that is either visible or not.
this.checkElement_ = Blockly.createSvgElement('text',
{'class': 'blocklyText', 'x': -3, 'y': 14}, this.fieldGroup_);
var textNode = document.createTextNode('\u2713');
{'class': 'blocklyText blocklyCheckbox', 'x': -3, 'y': 14},
this.fieldGroup_);
var textNode = document.createTextNode(Blockly.FieldCheckbox.CHECK_CHAR);
this.checkElement_.appendChild(textNode);
this.checkElement_.style.display = this.state_ ? 'block' : 'none';
};