From 30b285a4ea8aae1e92a55d9dc580c598e775ca6a Mon Sep 17 00:00:00 2001 From: Nathaniel Heintz Date: Fri, 12 Feb 2021 10:21:46 -0700 Subject: [PATCH] Update for suggested changes --- Classes/CalcBreakdownControl.lua | 2 +- Classes/ItemSlotControl.lua | 2 +- Classes/PassiveTreeView.lua | 16 +++++++--------- Classes/TreeTab.lua | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Classes/CalcBreakdownControl.lua b/Classes/CalcBreakdownControl.lua index f7f9b5b3..9bb23c26 100644 --- a/Classes/CalcBreakdownControl.lua +++ b/Classes/CalcBreakdownControl.lua @@ -572,7 +572,7 @@ function CalcBreakdownClass:DrawBreakdownTable(viewPort, x, y, section) viewer.zoomX = -ttNode.x / scale viewer.zoomY = -ttNode.y / scale SetViewport(viewerX + 2, viewerY + 2, 300, 300) - viewer:Draw(self.calcsTab.build, nil, { x = 0, y = 0, width = 300, height = 300 }, { }) + viewer:Draw(self.calcsTab.build, { x = 0, y = 0, width = 300, height = 300 }, { }) SetDrawLayer(nil, 30) SetDrawColor(1, 0, 0) DrawImage(viewer.highlightRing, 135, 135, 30, 30) diff --git a/Classes/ItemSlotControl.lua b/Classes/ItemSlotControl.lua index c532ce6a..5b5270a4 100644 --- a/Classes/ItemSlotControl.lua +++ b/Classes/ItemSlotControl.lua @@ -142,7 +142,7 @@ function ItemSlotClass:Draw(viewPort) viewer.zoomX = -node.x / scale viewer.zoomY = -node.y / scale SetViewport(viewerX + 2, viewerY + 2, 300, 300) - viewer:Draw(self.itemsTab.build, nil, { x = 0, y = 0, width = 300, height = 300 }, { }) + viewer:Draw(self.itemsTab.build, { x = 0, y = 0, width = 300, height = 300 }, { }) SetDrawLayer(nil, 30) SetDrawColor(1, 1, 1, 0.2) DrawImage(nil, 149, 0, 2, 300) diff --git a/Classes/PassiveTreeView.lua b/Classes/PassiveTreeView.lua index 88d269e4..4abf5349 100644 --- a/Classes/PassiveTreeView.lua +++ b/Classes/PassiveTreeView.lua @@ -93,12 +93,10 @@ function PassiveTreeViewClass:Save(xml) } end -function PassiveTreeViewClass:Draw(build, compareSpec, viewPort, inputEvents) +function PassiveTreeViewClass:Draw(build, viewPort, inputEvents) local spec = build.spec local tree = spec.tree - local isComparing = compareSpec and true or false; - local cursorX, cursorY = GetCursorPos() local mOver = cursorX >= viewPort.x and cursorX < viewPort.x + viewPort.width and cursorY >= viewPort.y and cursorY < viewPort.y + viewPort.height @@ -378,8 +376,8 @@ function PassiveTreeViewClass:Draw(build, compareSpec, viewPort, inputEvents) end local state = getState(node1, node2); local baseState = state - if isComparing then - local cNode1, cNode2 = compareSpec.nodes[connector.nodeId1], compareSpec.nodes[connector.nodeId2] + if self.compareSpec then + local cNode1, cNode2 = self.compareSpec.nodes[connector.nodeId1], self.compareSpec.nodes[connector.nodeId2] if cNode1 and cNode2 then baseState = getState(cNode1,cNode2) end @@ -440,10 +438,10 @@ function PassiveTreeViewClass:Draw(build, compareSpec, viewPort, inputEvents) -- Draw the nodes for nodeId, node in pairs(spec.nodes) do -- Determine the base and overlay images for this node based on type and state - local compareNode = isComparing and compareSpec.nodes[nodeId] or nil + local compareNode = self.compareSpec and self.compareSpec.nodes[nodeId] or nil local base, overlay - local isAlloc = node.alloc or build.calcsTab.mainEnv.grantedPassives[nodeId] or (isComparing and compareNode and compareNode.alloc) + local isAlloc = node.alloc or build.calcsTab.mainEnv.grantedPassives[nodeId] or (compareNode and compareNode.alloc) SetDrawLayer(nil, 25) if node.type == "ClassStart" then overlay = isAlloc and node.startArt or "PSStartNodeBackgroundInactive" @@ -553,7 +551,7 @@ function PassiveTreeViewClass:Draw(build, compareSpec, viewPort, inputEvents) end end else - if isComparing then + if compareNode then if compareNode.alloc and not node.alloc then -- Base has, current has not, color green (take these nodes to match) SetDrawColor(0, 1, 0) @@ -578,7 +576,7 @@ function PassiveTreeViewClass:Draw(build, compareSpec, viewPort, inputEvents) SetDrawColor(0, 0, 0) end else - if isComparing and compareNode then + if compareNode then if compareNode.alloc and not node.alloc then -- Base has, current has not, color green (take these nodes to match) SetDrawColor(0, 1, 0) diff --git a/Classes/TreeTab.lua b/Classes/TreeTab.lua index efc88607..7c91a92b 100644 --- a/Classes/TreeTab.lua +++ b/Classes/TreeTab.lua @@ -212,7 +212,8 @@ function TreeTabClass:Draw(viewPort, inputEvents) self.viewer:Focus(self.jumpToX, self.jumpToY, treeViewPort, self.build) self.jumpToNode = false end - self.viewer:Draw(self.build, self.isComparing and self.specList[self.activeCompareSpec] or nil, treeViewPort, inputEvents) + self.viewer.compareSpec = self.isComparing and self.specList[self.activeCompareSpec] or nil + self.viewer:Draw(self.build, treeViewPort, inputEvents) self.controls.compareSelect.selIndex = self.activeCompareSpec wipeTable(self.controls.compareSelect.list) @@ -340,7 +341,6 @@ function TreeTabClass:SetActiveSpec(specId) end function TreeTabClass:SetCompareSpec(specId) - local prevSpec = self.compareSpec self.activeCompareSpec = m_min(specId, #self.specList) local curSpec = self.specList[self.activeCompareSpec]