Skip to content

Commit

Permalink
fix(gui_flowui): avoid mutating arguments in Draw.Element (#2792)
Browse files Browse the repository at this point in the history
This would cause the alpha value in color2 to quickly increase over time
(for the caller and this function) unless a new table was passed for
every call to this function.
  • Loading branch information
salinecitrine authored Mar 28, 2024
1 parent ae52a8a commit 115733c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions luaui/Widgets/gui_flowui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,7 @@ WG.FlowUI.Draw.Element = function(px, py, sx, sy, tl, tr, br, bl, ptl, ptr, pb

-- element
cs = cs * 0.6
color2[4] = color2[4] * 1.25 -- multiply to compensate for inner border 'highlight'
WG.FlowUI.Draw.RectRound(px + pxPad, py + pyPad, sx - sxPad, sy - syPad, cs, tl, tr, br, bl, { color2[1]*0.33, color2[2]*0.33, color2[3]*0.33, color2[4] }, { color2[1], color2[2], color2[3], color2[4] })
WG.FlowUI.Draw.RectRound(px + pxPad, py + pyPad, sx - sxPad, sy - syPad, cs, tl, tr, br, bl, { color2[1]*0.33, color2[2]*0.33, color2[3]*0.33, color2[4] * 1.25 }, { color2[1], color2[2], color2[3], color2[4] * 1.25 })

-- element - inner darkening to create highlighted border
local pad2 = 1
Expand Down

0 comments on commit 115733c

Please sign in to comment.