canvas.gui: Button color tweaking.
This commit is contained in:
parent
4ff258ad70
commit
b5dae5b567
2 changed files with 24 additions and 9 deletions
|
@ -61,6 +61,18 @@ DefaultStyle.widgets.button = {
|
||||||
var (w, h) = model._size;
|
var (w, h) = model._size;
|
||||||
var file = me._style._dir_widgets ~ "/";
|
var file = me._style._dir_widgets ~ "/";
|
||||||
|
|
||||||
|
# TODO unify color names with image names
|
||||||
|
var bg_color_name = "button_bg_color";
|
||||||
|
if( backdrop )
|
||||||
|
bg_color_name = "button_backdrop_bg_color";
|
||||||
|
else if( !model._enabled )
|
||||||
|
bg_color_name = "button_bg_color_insensitive";
|
||||||
|
else if( model._down )
|
||||||
|
bg_color_name = "button_bg_color_down";
|
||||||
|
else if( model._hover )
|
||||||
|
bg_color_name = "button_bg_color_hover";
|
||||||
|
me._bg.set("fill", me._style.getColor(bg_color_name));
|
||||||
|
|
||||||
if( backdrop )
|
if( backdrop )
|
||||||
{
|
{
|
||||||
file ~= "backdrop-";
|
file ~= "backdrop-";
|
||||||
|
@ -78,25 +90,16 @@ DefaultStyle.widgets.button = {
|
||||||
else
|
else
|
||||||
me._label.setTranslation(w / 2, h / 2 + 5);
|
me._label.setTranslation(w / 2, h / 2 + 5);
|
||||||
|
|
||||||
|
|
||||||
if( model._enabled )
|
if( model._enabled )
|
||||||
{
|
{
|
||||||
if( model._focused and !backdrop )
|
if( model._focused and !backdrop )
|
||||||
file ~= "-focused";
|
file ~= "-focused";
|
||||||
|
|
||||||
if( model._hover and !model._down )
|
if( model._hover and !model._down )
|
||||||
{
|
|
||||||
file ~= "-hover";
|
file ~= "-hover";
|
||||||
me._bg.set("fill", me._style.getColor("button_bg_color_hover"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
me._bg.set("fill", me._style.getColor("button_bg_color"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file ~= "-disabled";
|
file ~= "-disabled";
|
||||||
me._bg.set("fill", me._style.getColor("button_bg_color_insensitive"));
|
|
||||||
}
|
|
||||||
|
|
||||||
me._border.set("src", file ~ ".png");
|
me._border.set("src", file ~ ".png");
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,18 @@
|
||||||
<blue type="float">0.941</blue>
|
<blue type="float">0.941</blue>
|
||||||
</button_bg_color>
|
</button_bg_color>
|
||||||
|
|
||||||
|
<button_backdrop_bg_color>
|
||||||
|
<red type="float">0.909</red>
|
||||||
|
<green type="float">0.905</green>
|
||||||
|
<blue type="float">0.901</blue>
|
||||||
|
</button_backdrop_bg_color>
|
||||||
|
|
||||||
|
<button_bg_color_down>
|
||||||
|
<red type="float">0.88</red>
|
||||||
|
<green type="float">0.87</green>
|
||||||
|
<blue type="float">0.86</blue>
|
||||||
|
</button_bg_color_down>
|
||||||
|
|
||||||
<button_bg_color_hover>
|
<button_bg_color_hover>
|
||||||
<red type="float">0.996</red>
|
<red type="float">0.996</red>
|
||||||
<green type="float">0.992</green>
|
<green type="float">0.992</green>
|
||||||
|
|
Loading…
Reference in a new issue