Minor code cleanup #930
This commit is contained in:
@@ -78,14 +78,13 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
/// <seealso cref="FlaxEditor.CustomEditors.Editors.Float3Editor" />
|
||||
public class ScaleEditor : Float3Editor
|
||||
{
|
||||
|
||||
private Image _linkImage;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
base.Initialize(layout);
|
||||
|
||||
|
||||
LinkValues = Editor.Instance.Windows.PropertiesWin.ScaleLinked;
|
||||
|
||||
_linkImage = new Image
|
||||
@@ -103,7 +102,10 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
LinkedLabel.SetupContextMenu += (label, menu, editor) =>
|
||||
{
|
||||
menu.AddSeparator();
|
||||
menu.AddButton(LinkValues ? "Unlink" : "Link", ToggleLink);
|
||||
if (LinkValues)
|
||||
menu.AddButton("Unlink", ToggleLink).LinkTooltip("Unlinks scale components from uniform scaling");
|
||||
else
|
||||
menu.AddButton("Link", ToggleLink).LinkTooltip("Links scale components for uniform scaling");
|
||||
};
|
||||
|
||||
// Override colors
|
||||
|
||||
@@ -97,30 +97,27 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
return;
|
||||
if (LinkValues)
|
||||
_valueChanged = ValueChanged.X;
|
||||
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
|
||||
private void OnYValueChanged()
|
||||
{
|
||||
if (IsSetBlocked)
|
||||
return;
|
||||
if (LinkValues)
|
||||
_valueChanged = ValueChanged.Y;
|
||||
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
|
||||
private void OnZValueChanged()
|
||||
{
|
||||
if (IsSetBlocked)
|
||||
return;
|
||||
if (LinkValues)
|
||||
_valueChanged = ValueChanged.Z;
|
||||
|
||||
OnValueChanged();
|
||||
}
|
||||
|
||||
|
||||
private void OnValueChanged()
|
||||
{
|
||||
if (IsSetBlocked)
|
||||
@@ -150,8 +147,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
xValue += valueChange;
|
||||
yValue += valueChange;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user