Skip to content

Commit

Permalink
Merge branch 'treenode-guidelines' of https://github.com/Tryibion/Fla…
Browse files Browse the repository at this point in the history
…xEngine into Tryibion-treenode-guidelines
  • Loading branch information
mafiesto4 committed May 15, 2024
2 parents 63cc0fe + fc7628e commit 1c7f06e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Source/Editor/GUI/Tree/TreeNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,38 @@ public override void Draw()
}
}

// Show tree guide lines
if (Editor.Instance.Options.Options.Interface.ShowTreeLines)
{
TreeNode parentNode = Parent as TreeNode;
bool thisNodeIsLast = false;
while (parentNode != null && parentNode != ParentTree.Children[0])
{
float bottomOffset = 0;
float topOffset = 0;

if (Parent == parentNode && this == Parent.Children[0])
topOffset = 2;

if (thisNodeIsLast && parentNode.Children.Count == 1)
bottomOffset = topOffset != 0 ? 4 : 2;

if (Parent == parentNode && this == Parent.Children[Parent.Children.Count - 1] && !_opened)
{
thisNodeIsLast = true;
bottomOffset = topOffset != 0 ? 4 : 2;
}

float leftOffset = 9;
// Adjust offset for icon image
if (_iconCollaped.IsValid)
leftOffset += 18;
var lineRect1 = new Rectangle(parentNode.TextRect.Left - leftOffset, parentNode.HeaderRect.Top + topOffset, 1, parentNode.HeaderRect.Height - bottomOffset);
Render2D.FillRectangle(lineRect1, isSelected ? style.ForegroundGrey : style.LightBackground);
parentNode = parentNode.Parent as TreeNode;
}
}

// Base
if (_opened)
{
Expand Down
7 changes: 7 additions & 0 deletions Source/Editor/Options/InterfaceOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ public enum ValueFormattingType
[EditorDisplay("Interface"), EditorOrder(310)]
public bool SeparateValueAndUnit { get; set; }

/// <summary>
/// Gets or sets the option to put a space between numbers and units for unit formatting.
/// </summary>
[DefaultValue(true)]
[EditorDisplay("Interface"), EditorOrder(320)]
public bool ShowTreeLines { get; set; } = true;

/// <summary>
/// Gets or sets the timestamps prefix mode for output log messages.
/// </summary>
Expand Down

0 comments on commit 1c7f06e

Please sign in to comment.