fix still being able to open/ close script editor with no fields
Introduces "CanOpenClose" to DropPanel. If false, will ignore the user clicking on the header (or the arrow) to open or collapse the panel
This commit is contained in:
@@ -914,9 +914,11 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
// Remove drop down arrows and containment lines if no objects in the group
|
||||
if (group.Children.Count == 0)
|
||||
{
|
||||
group.Panel.Close();
|
||||
group.Panel.ArrowImageOpened = null;
|
||||
group.Panel.ArrowImageClosed = null;
|
||||
group.Panel.EnableContainmentLines = false;
|
||||
group.Panel.CanOpenClose = false;
|
||||
}
|
||||
|
||||
// Scripts arrange bar
|
||||
|
||||
@@ -104,13 +104,20 @@ namespace FlaxEngine.GUI
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether enable drop down icon drawing.
|
||||
/// </summary>
|
||||
[EditorOrder(1)]
|
||||
[EditorOrder(2)]
|
||||
public bool EnableDropDownIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Get or sets a value indicating whether the panel can be opened or closed via the user interacting with the ui.
|
||||
/// Changing the open/ closed state from code or the Properties panel will still work regardless.
|
||||
/// </summary>
|
||||
[EditorOrder(1)]
|
||||
public bool CanOpenClose { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether to enable containment line drawing,
|
||||
/// </summary>
|
||||
[EditorOrder(2)]
|
||||
[EditorOrder(3)]
|
||||
public bool EnableContainmentLines { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
@@ -369,7 +376,7 @@ namespace FlaxEngine.GUI
|
||||
}
|
||||
|
||||
// Header
|
||||
var color = _mouseOverHeader ? HeaderColorMouseOver : HeaderColor;
|
||||
var color = _mouseOverHeader && CanOpenClose ? HeaderColorMouseOver : HeaderColor;
|
||||
if (color.A > 0.0f)
|
||||
{
|
||||
Render2D.FillRectangle(new Rectangle(0, 0, Width, HeaderHeight), color);
|
||||
@@ -510,7 +517,7 @@ namespace FlaxEngine.GUI
|
||||
if (button == MouseButton.Left && _mouseButtonLeftDown)
|
||||
{
|
||||
_mouseButtonLeftDown = false;
|
||||
if (_mouseOverHeader)
|
||||
if (_mouseOverHeader && CanOpenClose)
|
||||
Toggle();
|
||||
return true;
|
||||
}
|
||||
@@ -540,7 +547,7 @@ namespace FlaxEngine.GUI
|
||||
if (button == MouseButton.Left && _mouseButtonLeftDown)
|
||||
{
|
||||
_mouseButtonLeftDown = false;
|
||||
if (_mouseOverHeader)
|
||||
if (_mouseOverHeader && CanOpenClose)
|
||||
Toggle();
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user