Merge pull request #19960 from groud/fix_control_size

Fixes control nodes size not updated when outside the tree
This commit is contained in:
Max Hilbrunner 2018-07-04 23:32:29 +02:00 committed by GitHub
commit 9986b64b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 14 deletions

View File

@ -1295,9 +1295,6 @@ Size2 Control::get_parent_area_size() const {
void Control::_size_changed() {
if (!is_inside_tree())
return;
Rect2 parent_rect = get_parent_anchorable_rect();
float margin_pos[4];
@ -1334,7 +1331,7 @@ void Control::_size_changed() {
}
// We use a little workaround to avoid flickering when moving the pivot with _edit_set_pivot()
if (Math::abs(Math::sin(data.rotation * 4.0f)) < 0.00001f && get_viewport()->is_snap_controls_to_pixels_enabled()) {
if (is_inside_tree() && Math::abs(Math::sin(data.rotation * 4.0f)) < 0.00001f && get_viewport()->is_snap_controls_to_pixels_enabled()) {
new_size_cache = new_size_cache.round();
new_pos_cache = new_pos_cache.round();
}
@ -1344,6 +1341,7 @@ void Control::_size_changed() {
data.pos_cache = new_pos_cache;
data.size_cache = new_size_cache;
if (is_inside_tree()) {
if (size_changed) {
notification(NOTIFICATION_RESIZED);
}
@ -1356,6 +1354,7 @@ void Control::_size_changed() {
if (pos_changed && !size_changed) {
_update_canvas_item_transform(); //move because it won't be updated
}
}
}
void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bool p_push_opposite_anchor) {