Fix placement and usage of the new instance creation button in GenericEditor

This commit is contained in:
Wojtek Figat
2021-03-01 11:44:18 +01:00
parent b4e09a9d55
commit e0c6f7e8b2

View File

@@ -434,16 +434,18 @@ namespace FlaxEditor.CustomEditors.Editors
{ {
Text = "+", Text = "+",
TooltipText = "Create a new instance of the object", TooltipText = "Create a new instance of the object",
Height = ButtonSize, Size = new Vector2(ButtonSize, ButtonSize),
Width = ButtonSize,
X = layout.ContainerControl.Width - ButtonSize - 4,
AnchorPreset = AnchorPresets.MiddleRight, AnchorPreset = AnchorPresets.MiddleRight,
Parent = layout.ContainerControl Parent = layout.ContainerControl,
Location = new Vector2(layout.ContainerControl.Width - ButtonSize - 4, (layout.ContainerControl.Height - ButtonSize) * 0.5f),
}; };
button.Clicked += () => button.Clicked += () =>
{ {
var newType = Values.Type; var newType = Values.Type;
SetValue(newType.CreateInstance()); SetValue(newType.CreateInstance());
if (ParentEditor != null)
ParentEditor.RebuildLayoutOnRefresh();
else
RebuildLayoutOnRefresh(); RebuildLayoutOnRefresh();
}; };
} }