diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/control.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 76275c2420..8cbd6480fb 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; |