Skip to content

Commit

Permalink
Fixed BeginTree not returning IsOpen flag correcty
Browse files Browse the repository at this point in the history
  • Loading branch information
flamendless committed Aug 21, 2021
1 parent d7d1a6a commit f71d42b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Internal/UI/Tree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Tree.Begin(Id, Options)
Options = Options == nil and {} or Options
Options.Label = Options.Label == nil and IdLabel or Options.Label
Options.Tooltip = Options.Tooltip == nil and "" or Options.Tooltip
Options.OpenWithHighlight = Options.OpenWithHighlight == nil and true or OpenWithHighlight
Options.OpenWithHighlight = Options.OpenWithHighlight == nil and true or Options.OpenWithHighlight
Options.Icon = Options.Icon == nil and nil or Options.Icon
Options.IsSelected = Options.IsSelected == nil and false or Options.IsSelected
Options.IsOpen = Options.IsOpen == nil and false or Options.IsOpen
Expand Down Expand Up @@ -177,6 +177,7 @@ function Tree.Begin(Id, Options)
HoverColor = {0, 0, 0, 0},
PressColor = {0, 0, 0, 0}
}

if Button.Begin(Instance.Id .. '_Expand', ExpandIconOptions) and not Options.OpenWithHighlight then
Instance.IsOpen = not Instance.IsOpen
Window.SetHotItem(nil)
Expand Down Expand Up @@ -223,10 +224,6 @@ function Tree.Begin(Id, Options)
Cursor.SetY(Instance.Y)
Cursor.AdvanceY(H)

if Options.IsOpen then
Instance.IsOpen = true
end

if Instance.IsOpen then
insert(Hierarchy, 1, Instance)
end
Expand Down

0 comments on commit f71d42b

Please sign in to comment.