summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-18 09:53:25 +0200
committerGitHub <noreply@github.com>2019-06-18 09:53:25 +0200
commitd61d1af64d8f69cf0c9f46d32291e8b7313a0e52 (patch)
treee28df63c82dca77c0366d584b892a56e14bbee3d /scene/gui
parent3caed76edaead682e247fa6927676223779f4c7c (diff)
parentdf0a69bbaca690e1954d5048cc238acc8adeddb8 (diff)
Merge pull request #29489 from groud/fixes_nan
Fixes NaN errors with anchors mode
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 9d7c08d3f3..0845b56828 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1749,6 +1749,9 @@ Rect2 Control::_compute_child_rect(const float p_anchors[4], const float p_margi
void Control::_compute_anchors(Rect2 p_rect, const float p_margins[4], float (&r_anchors)[4]) {
Size2 parent_rect_size = get_parent_anchorable_rect().size;
+ ERR_FAIL_COND(parent_rect_size.x == 0.0);
+ ERR_FAIL_COND(parent_rect_size.y == 0.0);
+
r_anchors[0] = (p_rect.position.x - p_margins[0]) / parent_rect_size.x;
r_anchors[1] = (p_rect.position.y - p_margins[1]) / parent_rect_size.y;
r_anchors[2] = (p_rect.position.x + p_rect.size.x - p_margins[2]) / parent_rect_size.x;