Skip to content

Commit 8a43ea6

Browse files
author
justjuangui
committed
Refactor DrawQuadAndRotate to handle different data lengths for vertex calculations
1 parent fdc95dc commit 8a43ea6

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

src/Classes/PassiveTreeView.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ function PassiveTreeViewClass:Draw(build, viewPort, inputEvents)
604604
local angleRad = (math.pi / 2) + math.atan2(startNode.y - yActive, startNode.x - xActive)
605605
treeCenterActive.width = class.background['active'].width
606606
treeCenterActive.height = class.background['active'].height
607-
-- self:DrawQuadAndRotate(treeCenterActive, class.background.x * tree.scaleImage, class.background.y * tree.scaleImage, angleRad, treeToScreen)
607+
self:DrawQuadAndRotate(treeCenterActive, class.background.x * tree.scaleImage, class.background.y * tree.scaleImage, angleRad, treeToScreen)
608608

609609
treeCenter.width = class.background['bg'].width
610610
treeCenter.height = class.background['bg'].height
@@ -1361,8 +1361,19 @@ function PassiveTreeViewClass:DrawQuadAndRotate(data, xTree, yTree, angleRad, tr
13611361
vertActive[3], vertActive[4] = xActive + widthActive, yActive - heightActive
13621362
vertActive[5], vertActive[6] = xActive + widthActive, yActive + heightActive
13631363
vertActive[7], vertActive[8] = xActive - widthActive, yActive + heightActive
1364-
for iData, vData in ipairs(data) do
1365-
vertActive[9 + (iData - 1)] = vData -- s1
1364+
1365+
local lengthData = #data
1366+
if lengthData == 1 then
1367+
vertActive[9] = data[1] -- s1 (stack)
1368+
elseif lengthData == 4 then
1369+
vertActive[9], vertActive[10] = data[1], data[2] -- top-left
1370+
vertActive[11], vertActive[12] = data[3], data[2] -- top-right
1371+
vertActive[13], vertActive[14] = data[3], data[4] -- bottom-right
1372+
vertActive[15], vertActive[16] = data[1], data[4] -- bottom-left
1373+
else
1374+
for iData, vData in ipairs(data) do
1375+
vertActive[9 + (iData - 1)] = vData
1376+
end
13661377
end
13671378

13681379
-- rotate the quad

0 commit comments

Comments
 (0)