Merge pull request #92841 from kleonc/menu-bar-proper-canvas-transform-popup-calculation

Fix `MenuBar` popup placement assuming it's in viewport default canvas
This commit is contained in:
Rémi Verschelde 2024-08-19 16:04:54 +02:00
commit a105553a1d
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 3 additions and 2 deletions

View File

@ -121,8 +121,9 @@ void MenuBar::_open_popup(int p_index, bool p_focus_item) {
} }
Rect2 item_rect = _get_menu_item_rect(p_index); Rect2 item_rect = _get_menu_item_rect(p_index);
Point2 screen_pos = get_screen_position() + item_rect.position * get_viewport()->get_canvas_transform().get_scale(); Size2 canvas_scale = get_canvas_transform().get_scale();
Size2 screen_size = item_rect.size * get_viewport()->get_canvas_transform().get_scale(); Point2 screen_pos = get_screen_position() + item_rect.position * canvas_scale;
Size2 screen_size = item_rect.size * canvas_scale;
active_menu = p_index; active_menu = p_index;