various fixes and improvements. size changes for headers, deactivate containement for collections.

This commit is contained in:
Chandler Cox
2023-01-21 13:35:51 -06:00
parent 634eb0973b
commit 66fd5e716c
5 changed files with 26 additions and 6 deletions

View File

@@ -94,7 +94,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
{
if (actor != null)
group.Panel.TooltipText = Surface.SurfaceUtils.GetVisualScriptTypeDescription(TypeUtils.GetObjectType(actor));
const float settingsButtonSize = 14;
const float settingsButtonSize = 20;
var settingsButton = new Image
{
TooltipText = "Settings",

View File

@@ -641,16 +641,16 @@ namespace FlaxEditor.CustomEditors.Dedicated
IsScrollable = false,
Checked = script.Enabled,
Parent = group.Panel,
Size = new Float2(14, 14),
Bounds = new Rectangle(16, 0, 14, 14),
BoxSize = 12.0f,
Size = new Float2(20, 20),
Bounds = new Rectangle(20, 0, 20, 20),
BoxSize = 16.0f,
Tag = script,
};
scriptToggle.StateChanged += OnScriptToggleCheckChanged;
_scriptToggles[i] = scriptToggle;
// Add drag button to the group
const float dragIconSize = 14;
const float dragIconSize = 20;
var scriptDrag = new ScriptDragIcon(this, script)
{
TooltipText = "Script reference",
@@ -665,7 +665,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
};
// Add settings button to the group
const float settingsButtonSize = 14;
const float settingsButtonSize = 20;
var settingsButton = new Image
{
TooltipText = "Settings",

View File

@@ -18,6 +18,9 @@ namespace FlaxEditor.CustomEditors.Elements
ArrowImageClosed = new SpriteBrush(Style.Current.ArrowRight),
ArrowImageOpened = new SpriteBrush(Style.Current.ArrowDown),
EnableDropDownIcon = true,
ItemsMargin = new Margin(7, 7, 3, 3),
HeaderHeight = 20,
EnableContainmentLines = true,
};
/// <inheritdoc />

View File

@@ -96,6 +96,7 @@ namespace FlaxEditor.CustomEditors
if (useTransparentHeader)
{
element.Panel.EnableDropDownIcon = true;
element.Panel.EnableContainmentLines = false;
element.Panel.HeaderColor = element.Panel.HeaderColorMouseOver = Color.Transparent;
}
OnAddElement(element);

View File

@@ -131,6 +131,12 @@ namespace FlaxEngine.GUI
[EditorDisplay("Style"), EditorOrder(2000)]
public bool EnableDropDownIcon { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable containment line drawing,
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public bool EnableContainmentLines { get; set; } = false;
/// <summary>
/// Occurs when mouse right-clicks over the header.
/// </summary>
@@ -370,6 +376,16 @@ namespace FlaxEngine.GUI
Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center);
if (!_isClosed && EnableContainmentLines)
{
Color lineColor = Style.Current.ForegroundGrey - new Color(0, 0, 0, 100);
float lineThickness = 0.05f;
Render2D.DrawLine(new Float2(1, HeaderHeight), new Float2(1, Height), lineColor, lineThickness);
Render2D.DrawLine(new Float2(1, Height), new Float2(Width, Height), lineColor, lineThickness);
Render2D.DrawLine(new Float2(Width, HeaderHeight), new Float2(Width, Height), lineColor, lineThickness);
}
// Children
DrawChildren();
}