From e7e3be34ec384c18404e669025ea0b91908c206e Mon Sep 17 00:00:00 2001 From: Rindbee Date: Sun, 4 Jun 2023 11:31:09 +0800 Subject: [PATCH] Update size according to the order of entering tree To calculate the size of a control, it is necessary to first calculate the size of the parent control. Previously, the size was actually calculated on first display, and the call in `NOTIFICATION_POST_ENTER_TREE` was not necessary. --- scene/gui/control.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index c28cfeea1d33..a59739d93c01 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -3128,6 +3128,8 @@ void Control::_notification(int p_notification) { } break; case NOTIFICATION_ENTER_TREE: { + data.is_rtl_dirty = true; + _size_changed(); #ifdef TOOLS_ENABLED if (is_part_of_edited_scene()) { // Don't translate Controls on scene when inside editor. @@ -3138,11 +3140,6 @@ void Control::_notification(int p_notification) { notification(NOTIFICATION_THEME_CHANGED); } break; - case NOTIFICATION_POST_ENTER_TREE: { - data.is_rtl_dirty = true; - _size_changed(); - } break; - case NOTIFICATION_EXIT_TREE: { release_focus(); get_viewport()->_gui_remove_control(this);