1
0
Fork 0

Merge pull request #100429 from havi05/itemlist-draw-focus-syle-last

`Itemlist` draw focus stylebox after items
This commit is contained in:
Rémi Verschelde 2024-12-17 16:19:25 +01:00
commit b69a28a613
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 7 additions and 6 deletions

View File

@ -1087,12 +1087,6 @@ void ItemList::_notification(int p_what) {
}
bool rtl = is_layout_rtl();
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true);
draw_style_box(theme_cache.focus_style, Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false);
}
// Ensure_selected_visible needs to be checked before we draw the list.
if (ensure_selected_visible && current >= 0 && current < items.size()) {
Rect2 r = items[current].rect_cache;
@ -1381,6 +1375,7 @@ void ItemList::_notification(int p_what) {
cursor_rcache = rcache;
}
}
if (cursor_rcache.size != Size2()) { // Draw cursor last, so border isn't cut off.
cursor_rcache.position += base_ofs;
@ -1390,6 +1385,12 @@ void ItemList::_notification(int p_what) {
draw_style_box(cursor, cursor_rcache);
}
if (has_focus()) {
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), true);
draw_style_box(theme_cache.focus_style, Rect2(Point2(), size));
RenderingServer::get_singleton()->canvas_item_add_clip_ignore(get_canvas_item(), false);
}
} break;
}
}