mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-28 22:10:31 -04:00
Color fixes for text drop-down menus (#403)
* Add class for drop-down text colour; remove arrow special case * Use secondary colours in drop-down blocks * Add comment about updateTextNode_ resetting the class
This commit is contained in:
parent
55f2178dfa
commit
85578d8c7c
5 changed files with 13 additions and 8 deletions
|
@ -182,7 +182,7 @@ Blockly.Blocks['control_stop_menu'] = {
|
|||
],
|
||||
"inputsInline": true,
|
||||
"output": "String",
|
||||
"colour": Blockly.Colours.control.primary,
|
||||
"colour": Blockly.Colours.control.secondary,
|
||||
"colourSecondary": Blockly.Colours.control.secondary,
|
||||
"colourTertiary": Blockly.Colours.control.tertiary
|
||||
});
|
||||
|
@ -342,7 +342,7 @@ Blockly.Blocks['control_create_clone_of_menu'] = {
|
|||
],
|
||||
"inputsInline": true,
|
||||
"output": "String",
|
||||
"colour": Blockly.Colours.control.primary,
|
||||
"colour": Blockly.Colours.control.secondary,
|
||||
"colourSecondary": Blockly.Colours.control.secondary,
|
||||
"colourTertiary": Blockly.Colours.control.tertiary
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ Blockly.Blocks['event_broadcast_menu'] = {
|
|||
],
|
||||
"inputsInline": true,
|
||||
"output": "String",
|
||||
"colour": Blockly.Colours.event.primary,
|
||||
"colour": Blockly.Colours.event.secondary,
|
||||
"colourSecondary": Blockly.Colours.event.secondary,
|
||||
"colourTertiary": Blockly.Colours.event.tertiary
|
||||
});
|
||||
|
|
|
@ -510,7 +510,7 @@ Blockly.Blocks['operator_mathop_menu'] = {
|
|||
],
|
||||
"inputsInline": true,
|
||||
"output": "String",
|
||||
"colour": Blockly.Colours.operators.primary,
|
||||
"colour": Blockly.Colours.operators.secondary,
|
||||
"colourSecondary": Blockly.Colours.operators.secondary,
|
||||
"colourTertiary": Blockly.Colours.operators.tertiary
|
||||
});
|
||||
|
|
|
@ -382,6 +382,10 @@ Blockly.Css.CONTENT = [
|
|||
'stroke-width: 2;',
|
||||
'}',
|
||||
|
||||
'.blocklyDropdownText {',
|
||||
'fill: #fff !important;',
|
||||
'}',
|
||||
|
||||
'.blocklyBubbleText {',
|
||||
'fill: $colour_text;',
|
||||
'}',
|
||||
|
|
|
@ -288,10 +288,6 @@ Blockly.FieldDropdown.prototype.setValue = function(newValue) {
|
|||
* @param {?string} text New text.
|
||||
*/
|
||||
Blockly.FieldDropdown.prototype.setText = function(text) {
|
||||
if (this.sourceBlock_ && this.arrow_) {
|
||||
// Update arrow's colour.
|
||||
this.arrow_.style.fill = this.sourceBlock_.getColour();
|
||||
}
|
||||
if (text === null || text === this.text_) {
|
||||
// No change if null.
|
||||
return;
|
||||
|
@ -300,6 +296,11 @@ Blockly.FieldDropdown.prototype.setText = function(text) {
|
|||
this.updateTextNode_();
|
||||
|
||||
if (this.textElement_) {
|
||||
// Update class for dropdown text.
|
||||
// This class is reset every time updateTextNode_ is called.
|
||||
this.textElement_.setAttribute('class',
|
||||
this.textElement_.getAttribute('class') + ' blocklyDropdownText'
|
||||
);
|
||||
// Insert dropdown arrow.
|
||||
if (this.sourceBlock_.RTL) {
|
||||
this.textElement_.insertBefore(this.arrow_, this.textElement_.firstChild);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue