Skip to content

Commit

Permalink
Fix Control nodes emitting unnecessary resized signals
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometror committed Jul 4, 2024
1 parent 6a13fdc commit 1c47fd7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions scene/gui/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,11 +1732,15 @@ void Control::_size_changed() {
new_size_cache.height = minimum_size.height;
}

bool pos_changed = new_pos_cache != data.pos_cache;
bool size_changed = new_size_cache != data.size_cache;
bool pos_changed = !new_pos_cache.is_equal_approx(data.pos_cache);
bool size_changed = !new_size_cache.is_equal_approx(data.size_cache);

data.pos_cache = new_pos_cache;
data.size_cache = new_size_cache;
if (pos_changed) {
data.pos_cache = new_pos_cache;
}
if (size_changed) {
data.size_cache = new_size_cache;
}

if (is_inside_tree()) {
if (pos_changed || size_changed) {
Expand All @@ -1751,12 +1755,10 @@ void Control::_size_changed() {
}

if (pos_changed && !size_changed) {
_update_canvas_item_transform(); //move because it won't be updated
}
} else {
if (pos_changed) {
_notify_transform();
_update_canvas_item_transform();
}
} else if (pos_changed) {
_notify_transform();
}
}

Expand Down

0 comments on commit 1c47fd7

Please sign in to comment.