Merge pull request #90832 from YeldhamDev/just_ignore_the_margin_bro

Fix incorrect submenu icon and accelerator text positions involving margins
This commit is contained in:
Thaddeus Crews 2025-09-01 12:25:44 -05:00
commit 8ccb7ba2ec
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -924,9 +924,9 @@ void PopupMenu::_draw_items() {
// Submenu arrow on right hand side. // Submenu arrow on right hand side.
if (items[i].submenu) { if (items[i].submenu) {
if (rtl) { if (rtl) {
submenu->draw(ci, Point2(theme_cache.panel_style->get_margin(SIDE_LEFT) + theme_cache.item_end_padding, item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color); submenu->draw(ci, Point2(theme_cache.item_end_padding, item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color);
} else { } else {
submenu->draw(ci, Point2(display_width - theme_cache.panel_style->get_margin(SIDE_RIGHT) - submenu->get_width() - theme_cache.item_end_padding, item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color); submenu->draw(ci, Point2(display_width - submenu->get_width() - theme_cache.item_end_padding, item_ofs.y + Math::floor(h - submenu->get_height()) / 2), icon_color);
} }
} }
@ -961,9 +961,9 @@ void PopupMenu::_draw_items() {
// Accelerator / Shortcut // Accelerator / Shortcut
if (items[i].accel != Key::NONE || (items[i].shortcut.is_valid() && items[i].shortcut->has_valid_event())) { if (items[i].accel != Key::NONE || (items[i].shortcut.is_valid() && items[i].shortcut->has_valid_event())) {
if (rtl) { if (rtl) {
item_ofs.x = theme_cache.panel_style->get_margin(SIDE_LEFT) + theme_cache.item_end_padding; item_ofs.x = theme_cache.item_end_padding;
} else { } else {
item_ofs.x = display_width - theme_cache.panel_style->get_margin(SIDE_RIGHT) - items[i].accel_text_buf->get_size().x - theme_cache.item_end_padding; item_ofs.x = display_width - items[i].accel_text_buf->get_size().x - theme_cache.item_end_padding;
} }
Vector2 text_pos = item_ofs + Point2(0, Math::floor((h - items[i].accel_text_buf->get_size().y) / 2.0)); Vector2 text_pos = item_ofs + Point2(0, Math::floor((h - items[i].accel_text_buf->get_size().y) / 2.0));
if (theme_cache.font_outline_size > 0 && theme_cache.font_outline_color.a > 0) { if (theme_cache.font_outline_size > 0 && theme_cache.font_outline_color.a > 0) {