Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Classes/CalcSectionControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function CalcSectionClass:IsMouseOver()
return mOver, colData
end
elseif cursorX >= colData.x and cursorY >= colData.y and cursorX < colData.x + colData.width and cursorY < colData.y + colData.height then
colData.pinnedLabel = data.label
return mOver, colData
end
end
Expand Down Expand Up @@ -330,11 +331,19 @@ function CalcSectionClass:OnKeyDown(key, doubleClick)
return
end
if mOverComp then
--Add the stat to siderbar under "Pinned:"
if key == "RIGHTBUTTON" then
self.calcsTab:ToggleSidebarPinnedStat(mOverComp)
return
end
-- Pin the stat breakdown
self.calcsTab:SetDisplayStat(mOverComp, true)
return self.calcsTab.controls.breakdown
if key == "LEFTBUTTON" then
self.calcsTab:SetDisplayStat(mOverComp, true)
return self.calcsTab.controls.breakdown
end
end
end

return
end

Expand Down
43 changes: 43 additions & 0 deletions src/Classes/CalcsTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro
self.controls.search = new("EditControl", {"TOPLEFT",self,"TOPLEFT"}, {4, 5, 260, 20}, "", "Search", "%c", 100, nil, nil, nil, true)
t_insert(self.controls, self.controls.search)


self.controls.clearSidebarLabel = new("LabelControl", {"TOPLEFT", self, "TOPLEFT"}, {425, 5, 150, 18}, "Right-click any Calcs value to pin/unpin it to the sidebar.")
self.controls.clearSideBarPinnedStats = new("ButtonControl", {"TOPLEFT", self, "TOPLEFT"}, {270, 5, 150, 20}, "Clear Pinned Stats", function()
if self.sidebarPinnedStats and #self.sidebarPinnedStats > 0 then
self:ClearSidebarPinnedStats()
return
end

end)

-- Special section for skill/mode selection
self:NewSection(3, "SkillSelect", 1, colorCodes.NORMAL, {{ defaultCollapsed = false, label = "View Skill Details", data = {
{ label = "Socket Group", { controlName = "mainSocketGroup",
Expand Down Expand Up @@ -411,6 +421,39 @@ function CalcsTabClass:SetDisplayStat(displayData, pin)
self.controls.breakdown:SetBreakdownData(displayData, pin)
end

function CalcsTabClass:ToggleSidebarPinnedStat(displayData)
if not displayData or not displayData.format then
return
end

self.sidebarPinnedStats = self.sidebarPinnedStats or { }

local displayLabel = displayData.pinnedLabel or ""
local displayFormat = displayData.format or ""

for index, pinned in ipairs(self.sidebarPinnedStats) do
local pinnedLabel = pinned.pinnedLabel or ""
local pinnedFormat = pinned.format or ""

if pinnedLabel == displayLabel and pinnedFormat == displayFormat then
table.remove(self.sidebarPinnedStats, index)
self.build:RefreshStatList()
return
end
end

table.insert(self.sidebarPinnedStats, displayData)

self.build:RefreshStatList()
end

function CalcsTabClass:ClearSidebarPinnedStats()
if not self.sidebarPinnedStats or #self.sidebarPinnedStats == 0 then
return
end
wipeTable(self.sidebarPinnedStats)
self.build:RefreshStatList()
end
function CalcsTabClass:CheckFlag(obj)
local actor = self.input.showMinion and self.calcsEnv.minion or self.calcsEnv.player
local skillFlags = actor.mainSkill.activeEffect.statSetCalcs.skillFlags
Expand Down
10 changes: 10 additions & 0 deletions src/Modules/Build.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,16 @@ function buildMode:RefreshStatList()
t_insert(statBoxList, { height = 14, align = "CENTER_X", x = 140, self.calcsTab.mainEnv.player.mainSkill.disableReason })
end
self:AddDisplayStatList(self.displayStats, self.calcsTab.mainEnv.player)
if self.calcsTab.sidebarPinnedStats and #self.calcsTab.sidebarPinnedStats > 0 then
local actor = self.calcsTab.mainEnv.player
t_insert(statBoxList, { height = 10 })
t_insert(statBoxList, { height = 18, "^7Pinned Calcs:" })
for i, pinned in ipairs(self.calcsTab.sidebarPinnedStats) do
local label = pinned.pinnedLabel or ("Pinned " .. tostring(i))
local value = formatCalcStr(pinned.format, actor, pinned)
t_insert(statBoxList, { height = 16, "^7" .. label .. ":", "^7" .. tostring(value) })
end
end
self:InsertItemWarnings()
self:EstimatePlayerProgress()
end
Expand Down