Skip to content

Commit

Permalink
prevent uielements depth going out of control
Browse files Browse the repository at this point in the history
ok actually its possible for depth to not be the issue here, some things just return null for parents for no reason but this fix actually works exactly like its needed so im good
  • Loading branch information
poco0317 committed Jul 8, 2024
1 parent 583cec9 commit 76b53de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Themes/_fallback/Scripts/97 UIElements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ function Actor.GetButtonRoot(self, depth)

local buttonRoot = self
for i = 0, depth, 1 do
buttonRoot = buttonRoot:GetParent()
local r = buttonRoot:GetParent()
if r ~= nil then
buttonRoot = r
else
break
end
end

return buttonRoot
end

Expand Down Expand Up @@ -401,7 +405,7 @@ function BUTTON.GetTopButton(self, x, y)
if not v then
print("something very scary happened and i think i prevented it")
else
if v:IsOver(x, y) then
if v:IsOver(x, y) then
local z = v:GetTrueZ()
if z >= topZ then
topButton = v
Expand Down

0 comments on commit 76b53de

Please sign in to comment.