Adjust MissingScriptEditor layout for UI

This commit is contained in:
Wojtek Figat
2023-11-17 13:08:37 +01:00
parent 0beb389012
commit 719498e99b

View File

@@ -37,41 +37,32 @@ public class MissingScriptEditor : GenericEditor
Parent = _dropPanel, Parent = _dropPanel,
Height = 64, Height = 64,
}; };
_replaceScriptButton = new Button _replaceScriptButton = new Button
{ {
Text = "Replace Script", Text = "Replace Script",
TooltipText = "Replaces the missing script with a given script type", TooltipText = "Replaces the missing script with a given script type",
AnchorPreset = AnchorPresets.TopCenter, AnchorPreset = AnchorPresets.TopCenter,
Width = 240, Bounds = new Rectangle(-120, 0, 240, 24),
Height = 24,
X = -120,
Y = 0,
Parent = replaceScriptPanel, Parent = replaceScriptPanel,
}; };
_replaceScriptButton.Clicked += OnReplaceScriptButtonClicked; _replaceScriptButton.Clicked += OnReplaceScriptButtonClicked;
var replaceAllLabel = new Label var replaceAllLabel = new Label
{ {
Text = "Replace all matching missing scripts", Text = "Replace all matching missing scripts",
TooltipText = "Whether or not to apply this script change to all scripts missing the same type.", TooltipText = "Whether or not to apply this script change to all scripts missing the same type.",
AnchorPreset = AnchorPresets.BottomCenter, AnchorPreset = AnchorPresets.BottomCenter,
Y = -34, Y = -38,
Parent = replaceScriptPanel, Parent = replaceScriptPanel,
}; };
replaceAllLabel.X -= FlaxEngine.GUI.Style.Current.FontSmall.MeasureText(replaceAllLabel.Text).X;
_shouldReplaceAllCheckbox = new CheckBox _shouldReplaceAllCheckbox = new CheckBox
{ {
TooltipText = replaceAllLabel.TooltipText, TooltipText = replaceAllLabel.TooltipText,
AnchorPreset = AnchorPresets.BottomCenter, AnchorPreset = AnchorPresets.BottomCenter,
Y = -34, Y = -38,
Parent = replaceScriptPanel, Parent = replaceScriptPanel,
}; };
_shouldReplaceAllCheckbox.X -= _replaceScriptButton.Width * 0.5f + 0.5f;
float centerDifference = (_shouldReplaceAllCheckbox.Right - replaceAllLabel.Left) / 2; replaceAllLabel.X -= 52;
replaceAllLabel.X += centerDifference;
_shouldReplaceAllCheckbox.X += centerDifference;
base.Initialize(layout); base.Initialize(layout);
} }