diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 2fbf344ec9e..b6952c3024d 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -281,7 +281,7 @@ Ref create_editor_theme() { theme->set_color("drop_position_color", "Tree", highlight_color); // ItemList - Ref style_itemlist_cursor = make_flat_stylebox(highlight_color, 8, 8, 8, 8); + Ref style_itemlist_cursor = make_flat_stylebox(highlight_color, 4, 4, 4, 4); style_itemlist_cursor->set_draw_center(false); style_itemlist_cursor->set_border_size(1 * EDSCALE); style_itemlist_cursor->set_light_color(light_color_1); @@ -292,6 +292,7 @@ Ref create_editor_theme() { theme->set_stylebox("selected", "ItemList", style_tree_selected); theme->set_stylebox("bg_focus", "ItemList", focus_sbt); theme->set_stylebox("bg", "ItemList", style_bg); + theme->set_constant("vseparation", "ItemList", 5 * EDSCALE); Ref style_tab_fg = make_flat_stylebox(base_color, 15, 5, 15, 5); Ref style_tab_bg = make_flat_stylebox(base_color, 15, 5, 15, 5); diff --git a/scene/gui/item_list.cpp b/scene/gui/item_list.cpp index 371cf929fe6..2f0c7b9aaf1 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); }