diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-02-12 23:50:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 23:50:32 +0100 |
commit | 26b21dc0cb517f9baacdaceafe09285952540d6a (patch) | |
tree | 389394a1f1f7d7035aa93d895c48e42e940411d8 /scene/gui | |
parent | 35d8d86845650d0e996b35ae98263310cd9f5499 (diff) | |
parent | ddc8ec6b448edd69642d61c4827882a035498274 (diff) |
Merge pull request #58030 from pycbouh/editor-controls-dragging-n-lagging
Limit inspector updates when dragging anchored controls
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/control.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index aa59df6337..943ba8dfb1 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1585,14 +1585,25 @@ void Control::set_anchor_and_offset(Side p_side, real_t p_anchor, real_t p_pos, } void Control::_set_anchors_layout_preset(int p_preset) { - set_meta("_edit_layout_mode", (int)LayoutMode::LAYOUT_MODE_ANCHORS); + bool list_changed = false; + + if (has_meta("_edit_layout_mode") && (int)get_meta("_edit_layout_mode") != (int)LayoutMode::LAYOUT_MODE_ANCHORS) { + list_changed = true; + set_meta("_edit_layout_mode", (int)LayoutMode::LAYOUT_MODE_ANCHORS); + } if (p_preset == -1) { - set_meta("_edit_use_custom_anchors", true); - notify_property_list_changed(); + if (!has_meta("_edit_use_custom_anchors") || !(bool)get_meta("_edit_use_custom_anchors")) { + set_meta("_edit_use_custom_anchors", true); + notify_property_list_changed(); + } return; // Keep settings as is. } - set_meta("_edit_use_custom_anchors", false); + + if (!has_meta("_edit_use_custom_anchors") || (bool)get_meta("_edit_use_custom_anchors")) { + list_changed = true; + set_meta("_edit_use_custom_anchors", false); + } LayoutPreset preset = (LayoutPreset)p_preset; // Set correct anchors. @@ -1625,7 +1636,9 @@ void Control::_set_anchors_layout_preset(int p_preset) { // Select correct grow directions. set_grow_direction_preset(preset); - notify_property_list_changed(); + if (list_changed) { + notify_property_list_changed(); + } } int Control::_get_anchors_layout_preset() const { |