diff --git a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs index 8e67d0a57..c709894a7 100644 --- a/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/UIControlEditor.cs @@ -319,7 +319,7 @@ namespace FlaxEditor.CustomEditors.Dedicated { if (parentValue is Control parentControl) { - parentControl.SetAnchorPreset((AnchorPresets)value, centerToPosition, setPivot); + parentControl.SetAnchorPreset((AnchorPresets)value, !centerToPosition, setPivot); editedAny = true; } } diff --git a/Source/Engine/UI/GUI/Control.Bounds.cs b/Source/Engine/UI/GUI/Control.Bounds.cs index d7fbad5fc..717b3c4d7 100644 --- a/Source/Engine/UI/GUI/Control.Bounds.cs +++ b/Source/Engine/UI/GUI/Control.Bounds.cs @@ -490,9 +490,9 @@ namespace FlaxEngine.GUI /// Sets the anchor preset for the control. Can be use to auto-place the control for a given preset or can preserve the current control bounds. /// /// The anchor preset to set. - /// True if preserve current control bounds, otherwise will align control position accordingly to the anchor location. - /// True if pivot should be set too - public void SetAnchorPreset(AnchorPresets anchorPreset, bool centerToPosition, bool setPivotToo) + /// True if preserve current control bounds, otherwise will align control position accordingly to the anchor location. + /// Whether or not we should set the pivot too, eg left-top 0,0, bottom-right 1,1 + public void SetAnchorPreset(AnchorPresets anchorPreset, bool preserveBounds, bool setPivotToo = false) { for (int i = 0; i < AnchorPresetsData.Length; i++) { @@ -510,13 +510,13 @@ namespace FlaxEngine.GUI _anchorMin = anchorMin; _anchorMax = anchorMax; - if (!centerToPosition) + if (preserveBounds) { UpdateBounds(); Bounds = bounds; } } - if (centerToPosition) + if (!preserveBounds) { if (_parent != null) { diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs index b51fc615a..96b7bf22b 100644 --- a/Source/Engine/UI/GUI/Control.cs +++ b/Source/Engine/UI/GUI/Control.cs @@ -193,7 +193,7 @@ namespace FlaxEngine.GUI } return result; } - set => SetAnchorPreset(value, true, false); + set => SetAnchorPreset(value, false); } ///