Added bool to properties window to carry value between controls

This commit is contained in:
Olly Rybak
2023-05-29 20:55:55 +10:00
parent 522015c2d7
commit fce41b95f6
2 changed files with 10 additions and 3 deletions

View File

@@ -497,8 +497,9 @@ namespace FlaxEditor.CustomEditors.Dedicated
private void BuildExtraButtons(VerticalPanelElement group)
{
// Set to default for UI editing
(Values[0] as Control).PivotRelative = true;
(Values[0] as Control).PivotRelative = Editor.Instance.Windows.PropertiesWin.PivotRelativeSize;
var current = Editor.Instance.Windows.PropertiesWin.PivotRelativeSize;
var panel = group.CustomContainer<Panel>();
panel.CustomControl.Height = TextBoxBase.DefaultHeight;
@@ -515,7 +516,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
X = 77,
};
SetStyle(true);
SetStyle(current);
_pivotRelativeButton.Clicked += PivotRelativeClicked;
}
@@ -523,6 +524,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
var current = (Values[0] as Control).PivotRelative;
(Values[0] as Control).PivotRelative = !current;
Editor.Instance.Windows.PropertiesWin.PivotRelativeSize = !current;
SetStyle((Values[0] as Control).PivotRelative);
}

View File

@@ -30,6 +30,11 @@ namespace FlaxEditor.Windows
/// </summary>
public bool ScaleLinked = false;
/// <summary>
/// Indictation of if UI elements should size relative to the pivot point
/// </summary>
public bool PivotRelativeSize = true;
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesWindow"/> class.
/// </summary>