瀏覽代碼

Fix position and size of OptionButton PopupMenu

Use the correct Transform2D (get_global_transform_with_canvas) for
position and size.
Markus Sauermann 2 年之前
父節點
當前提交
95597bb2ac
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      scene/gui/option_button.cpp

+ 3 - 3
scene/gui/option_button.cpp

@@ -491,9 +491,9 @@ void OptionButton::show_popup() {
 		return;
 		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 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)) {
 	if (current != NONE_SELECTED && !popup->is_item_disabled(current)) {