summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-01-03 23:27:11 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-01-03 23:27:11 -0300
commitf39473ae7adf11e16b2a7aae2f84764a3225752b (patch)
tree96bfa46ad24a5d53f5d98a2dbf0ef2a9fd01ae86
parentdc7ac86b798f40e1472871391af49a562879eadc (diff)
-Obscure bug in popups solved, fixes #1008
-rw-r--r--scene/gui/popup.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp
index 65ad02723c..bccd05d4fe 100644
--- a/scene/gui/popup.cpp
+++ b/scene/gui/popup.cpp
@@ -51,11 +51,18 @@ void Popup::_fix_size() {
Control *window = get_window();
ERR_FAIL_COND(!window);
-
+
+#if 0
Point2 pos = get_pos();
Size2 size = get_size();
Point2 window_size = window==this ? get_parent_area_size() :window->get_size();
+#else
+
+ Point2 pos = get_global_pos();
+ Size2 size = get_size();
+ Point2 window_size = get_viewport_rect().size;
+#endif
if (pos.x+size.width > window_size.width)
pos.x=window_size.width-size.width;
if (pos.x<0)
@@ -65,8 +72,14 @@ void Popup::_fix_size() {
pos.y=window_size.height-size.height;
if (pos.y<0)
pos.y=0;
+#if 0
if (pos!=get_pos())
set_pos(pos);
+#else
+ if (pos!=get_pos())
+ set_global_pos(pos);
+
+#endif
}