diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-02-08 07:39:40 +0100 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-02-08 07:39:40 +0100 |
commit | 84fbe2d4cbdce9d92e9a835df5926cf0795d089f (patch) | |
tree | 73ea2c1459b32914cb18326d4806f8c69ba00c28 /scene/gui | |
parent | 6546ee1d63fe84f9fc5f9589788cc8c2ece9d6d1 (diff) | |
parent | 1120b6ae0dd997b67e178b903fc32c1a169f1448 (diff) |
Merge pull request #3409 from akien-mga/pr-script-tab-colour
Make custom_bg fit the whole "selected" area in ItemLists
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/item_list.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index f035cb7722..2d2cabfc01 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -826,22 +826,25 @@ void ItemList::_notification(int p_what) { if (current_columns==1) { rcache.size.width = width-rcache.pos.x; } - if (items[i].custom_bg.a>0.001) { - Rect2 r=rcache; - r.pos+=base_ofs; - draw_rect(r,items[i].custom_bg); - } - if (items[i].selected) { - Rect2 r=rcache; - r.pos+=base_ofs; - r.pos.x-=sbsel->get_margin(MARGIN_LEFT); - r.size.x+=sbsel->get_margin(MARGIN_LEFT)+sbsel->get_margin(MARGIN_RIGHT); - r.pos.y-=sbsel->get_margin(MARGIN_TOP); - r.size.y+=sbsel->get_margin(MARGIN_TOP)+sbsel->get_margin(MARGIN_BOTTOM); + Rect2 r=rcache; + r.pos+=base_ofs; - draw_style_box(sbsel,r); + // Use stylebox to dimension potential bg color, even if not selected + r.pos.x-=sbsel->get_margin(MARGIN_LEFT); + r.size.x+=sbsel->get_margin(MARGIN_LEFT)+sbsel->get_margin(MARGIN_RIGHT); + r.pos.y-=sbsel->get_margin(MARGIN_TOP); + r.size.y+=sbsel->get_margin(MARGIN_TOP)+sbsel->get_margin(MARGIN_BOTTOM); + if (items[i].selected) { + draw_style_box(sbsel,r); + } + if (items[i].custom_bg.a>0.001) { + r.pos.x+=2; + r.size.x-=4; + r.pos.y+=2; + r.size.y-=4; + draw_rect(r,items[i].custom_bg); } |