Make sure that data.last_minimum_size
is consistent with get_combined_minimum_size()
at the same time
Move the code for switching `data.minimum_size_valid` in `Control::update_minimum_size()` to `Control::_update_minimum_size()`, make sure to switch `data.minimum_size_valid` to `false` only before updating `data.last_minimum_size` , so that it will remain consistent with `get_combined_minimum_size()`.
This commit is contained in:
parent
5c2295ff53
commit
594852caf1
@ -1582,22 +1582,6 @@ void Control::_update_minimum_size() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Size2 minsize = get_combined_minimum_size();
|
|
||||||
data.updating_last_minimum_size = false;
|
|
||||||
|
|
||||||
if (minsize != data.last_minimum_size) {
|
|
||||||
data.last_minimum_size = minsize;
|
|
||||||
_size_changed();
|
|
||||||
emit_signal(SceneStringNames::get_singleton()->minimum_size_changed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Control::update_minimum_size() {
|
|
||||||
ERR_MAIN_THREAD_GUARD;
|
|
||||||
if (!is_inside_tree() || data.block_minimum_size_adjust) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Control *invalidate = this;
|
Control *invalidate = this;
|
||||||
|
|
||||||
// Invalidate cache upwards.
|
// Invalidate cache upwards.
|
||||||
@ -1620,6 +1604,21 @@ void Control::update_minimum_size() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Size2 minsize = get_combined_minimum_size();
|
||||||
|
data.updating_last_minimum_size = false;
|
||||||
|
if (minsize != data.last_minimum_size) {
|
||||||
|
data.last_minimum_size = minsize;
|
||||||
|
_size_changed();
|
||||||
|
emit_signal(SceneStringNames::get_singleton()->minimum_size_changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Control::update_minimum_size() {
|
||||||
|
ERR_MAIN_THREAD_GUARD;
|
||||||
|
if (!is_inside_tree() || data.block_minimum_size_adjust) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (data.updating_last_minimum_size) {
|
if (data.updating_last_minimum_size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3140,7 +3139,6 @@ void Control::_notification(int p_notification) {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_POST_ENTER_TREE: {
|
case NOTIFICATION_POST_ENTER_TREE: {
|
||||||
data.minimum_size_valid = false;
|
|
||||||
data.is_rtl_dirty = true;
|
data.is_rtl_dirty = true;
|
||||||
_size_changed();
|
_size_changed();
|
||||||
} break;
|
} break;
|
||||||
@ -3269,9 +3267,7 @@ void Control::_notification(int p_notification) {
|
|||||||
get_viewport()->_gui_hide_control(this);
|
get_viewport()->_gui_hide_control(this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
data.minimum_size_valid = false;
|
|
||||||
_update_minimum_size();
|
_update_minimum_size();
|
||||||
_size_changed();
|
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user