From 50e5c7f9807d85fea1fe549fa357cbad737a7961 Mon Sep 17 00:00:00 2001 From: toger5 Date: Sun, 4 Jun 2017 17:58:29 -0700 Subject: fixed overlapping of temp. colors (script editor) + added a little bit more spacing to the scripts in the script list. the temp colors now expand to the vseperation, instead of having the same size than the stylebox --- scene/gui/item_list.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'scene') diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 371cf929fe..2f0c7b9aaf 100644 --- a/scene/gui/item_list.cpp +++ b/scene/gui/item_list.cpp @@ -931,23 +931,26 @@ void ItemList::_notification(int p_what) { rcache.size.width = width - rcache.position.x; } - Rect2 r = rcache; - r.position += base_ofs; - - // Use stylebox to dimension potential bg color, even if not selected - r.position.x -= sbsel->get_margin(MARGIN_LEFT); - r.size.x += sbsel->get_margin(MARGIN_LEFT) + sbsel->get_margin(MARGIN_RIGHT); - r.position.y -= sbsel->get_margin(MARGIN_TOP); - r.size.y += sbsel->get_margin(MARGIN_TOP) + sbsel->get_margin(MARGIN_BOTTOM); - if (items[i].selected) { + Rect2 r = rcache; + r.position += base_ofs; + + // Use stylebox to dimension potential bg color + r.position.x -= sbsel->get_margin(MARGIN_LEFT); + r.size.x += sbsel->get_margin(MARGIN_LEFT) + sbsel->get_margin(MARGIN_RIGHT); + r.position.y -= sbsel->get_margin(MARGIN_TOP); + r.size.y += sbsel->get_margin(MARGIN_TOP) + sbsel->get_margin(MARGIN_BOTTOM); draw_style_box(sbsel, r); } + if (items[i].custom_bg.a > 0.001) { - r.position.x += 2; - r.size.x -= 4; - r.position.y += 2; - r.size.y -= 4; + + Rect2 r = rcache; + r.position += base_ofs; + + // Size rect to make the align the temperature colors + r.position.y -= vseparation / 2; + r.size.y += vseparation; draw_rect(r, items[i].custom_bg); } -- cgit v1.2.3