mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
[zelos] Set dropdown div colour to match block colour (#3462)
* Set dropdown div colour to match block colour
This commit is contained in:
@@ -595,7 +595,8 @@ Blockly.Css.CONTENT = [
|
||||
|
||||
'.blocklyWidgetDiv .goog-menuitem-content,',
|
||||
'.blocklyDropDownDiv .goog-menuitem-content {',
|
||||
'font: normal 13px Arial, sans-serif;',
|
||||
'font-family: Arial, sans-serif;',
|
||||
'font-size: 13px;',
|
||||
'}',
|
||||
|
||||
'.blocklyWidgetDiv .goog-menuitem-content {',
|
||||
|
||||
@@ -256,6 +256,14 @@ Blockly.FieldDropdown.prototype.showEditor_ = function() {
|
||||
Blockly.utils.dom.addClass(
|
||||
/** @type {!Element} */ (this.menu_.getElement()), 'blocklyDropdownMenu');
|
||||
|
||||
if (this.constants_.FIELD_DROPDOWN_COLOURED_DIV) {
|
||||
var primaryColour = (this.sourceBlock_.isShadow()) ?
|
||||
this.sourceBlock_.getParent().getColour() :
|
||||
this.sourceBlock_.getColour();
|
||||
Blockly.DropDownDiv.setColour(primaryColour,
|
||||
this.sourceBlock_.style.colourTertiary);
|
||||
}
|
||||
|
||||
Blockly.DropDownDiv.showPositionedByField(
|
||||
this, this.dropdownDispose_.bind(this));
|
||||
|
||||
|
||||
@@ -300,6 +300,13 @@ Blockly.blockRendering.ConstantProvider = function() {
|
||||
*/
|
||||
this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = this.FIELD_BORDER_RECT_HEIGHT;
|
||||
|
||||
/**
|
||||
* Whether or not a dropdown field's div should be coloured to match the
|
||||
* block colours.
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.FIELD_DROPDOWN_COLOURED_DIV = false;
|
||||
|
||||
/**
|
||||
* Whether or not a dropdown field uses a text or SVG arrow.
|
||||
* @type {boolean}
|
||||
|
||||
@@ -212,6 +212,11 @@ Blockly.zelos.ConstantProvider = function() {
|
||||
*/
|
||||
this.FIELD_DROPDOWN_BORDER_RECT_HEIGHT = 8 * this.GRID_UNIT;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
this.FIELD_DROPDOWN_COLOURED_DIV = true;
|
||||
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
@@ -166,6 +166,14 @@ Blockly.zelos.Renderer.prototype.getCSS_ = function() {
|
||||
selector + ' .blocklyDropdownText {',
|
||||
'fill: #fff !important;',
|
||||
'}',
|
||||
// Widget and Dropdown Div
|
||||
selector + '.blocklyWidgetDiv .goog-menuitem,',
|
||||
selector + '.blocklyDropDownDiv .goog-menuitem {',
|
||||
'font-family: ' + constants.FIELD_TEXT_FONTFAMILY + ';',
|
||||
'}',
|
||||
selector + '.blocklyDropDownDiv .goog-menuitem-content {',
|
||||
'color: #fff;',
|
||||
'}',
|
||||
|
||||
// Connection highlight.
|
||||
selector + ' .blocklyHighlightedConnectionPath {',
|
||||
|
||||
Reference in New Issue
Block a user