summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-16 14:41:52 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-16 14:41:52 +0100
commit2846ea1ffafddfc447036b37d255f72cb278b677 (patch)
treeb4b77209a50a25df11cabd89c3b3697f3a5b4c97
parent6d2a7cb46d6e839a4780cc72f731e8c2629f7ba3 (diff)
parent95597bb2acc238f9ae53a69d97617d331b38bf06 (diff)
Merge pull request #68573 from Sauermann/fix-optionbutton-popup
Fix position and size of OptionButton PopupMenu
-rw-r--r--scene/gui/option_button.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 0940b4c07b..6d0bbdd6af 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -491,9 +491,9 @@ void OptionButton::show_popup() {
return;
}
- Size2 size = get_size() * get_viewport()->get_canvas_transform().get_scale();
- popup->set_position(get_screen_position() + Size2(0, size.height * get_global_transform().get_scale().y));
- popup->set_size(Size2(size.width, 0));
+ Size2 button_size = get_global_transform_with_canvas().get_scale() * get_size();
+ popup->set_position(get_screen_position() + Size2(0, button_size.height));
+ popup->set_size(Size2i(button_size.width, 0));
// If not triggered by the mouse, start the popup with the checked item (or the first enabled one) focused.
if (current != NONE_SELECTED && !popup->is_item_disabled(current)) {