diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-01-16 22:41:10 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-01-16 22:41:10 -0300 |
commit | 72fcb8a35beab251d01864bc67da3e3a8e75aed6 (patch) | |
tree | 9ad5837e4237d1071a9e1a5b40efdaffa3f89f33 /scene/gui/popup.cpp | |
parent | 40818299231fe1854635ffe36d8b9565f430b35f (diff) | |
download | redot-engine-72fcb8a35beab251d01864bc67da3e3a8e75aed6.tar.gz |
-Moved all the "root" input handling for GUI from individual Controls to Viewport.
-Should fix several reported bugs when controls don't have a common parent
This may have added new bugs, so please report if so!
Diffstat (limited to 'scene/gui/popup.cpp')
-rw-r--r-- | scene/gui/popup.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 03ef50c491..1f04985ec6 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -59,8 +59,6 @@ void Popup::_notification(int p_what) { void Popup::_fix_size() { - Control *window = get_window(); - ERR_FAIL_COND(!window); #if 0 Point2 pos = get_pos(); @@ -182,14 +180,12 @@ void Popup::popup_centered_minsize(const Size2& p_minsize) { void Popup::popup_centered(const Size2& p_size) { - Control *window = get_window(); - ERR_FAIL_COND(!window); - + Point2 window_size = get_viewport_rect().size; emit_signal("about_to_show"); Rect2 rect; rect.size = p_size==Size2()?get_size():p_size; - Point2 window_size = window==this ? get_parent_area_size() :window->get_size(); + rect.pos = ((window_size-rect.size)/2.0).floor(); set_pos( rect.pos ); set_size( rect.size ); @@ -209,13 +205,11 @@ void Popup::popup_centered(const Size2& p_size) { void Popup::popup_centered_ratio(float p_screen_ratio) { - Control *window = get_window(); - ERR_FAIL_COND(!window); emit_signal("about_to_show"); Rect2 rect; - Point2 window_size = window==this ? get_parent_area_size() :window->get_size(); + Point2 window_size = get_viewport_rect().size; rect.size = (window_size * p_screen_ratio).floor(); rect.pos = ((window_size-rect.size)/2.0).floor(); set_pos( rect.pos ); |