Skip to content

Commit f0e6750

Browse files
committed
Added clear all button and tooltip
Added clear all pinned button and a tooltip. Also rewrote classname to "toggle" to better describe its function.
1 parent 3b8eadc commit f0e6750

3 files changed

Lines changed: 21 additions & 3 deletions

File tree

src/Classes/CalcSectionControl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ function CalcSectionClass:OnKeyDown(key, doubleClick)
333333
if mOverComp then
334334
--Add the stat to siderbar under "Pinned:"
335335
if key == "RIGHTBUTTON" then
336-
self.calcsTab:AddSidebarPinnedStat(mOverComp)
336+
self.calcsTab:ToggleSidebarPinnedStat(mOverComp)
337337
return
338338
end
339339
-- Pin the stat breakdown

src/Classes/CalcsTab.lua

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ local CalcsTabClass = newClass("CalcsTab", "UndoHandler", "ControlHost", "Contro
3535
self.controls.search = new("EditControl", {"TOPLEFT",self,"TOPLEFT"}, {4, 5, 260, 20}, "", "Search", "%c", 100, nil, nil, nil, true)
3636
t_insert(self.controls, self.controls.search)
3737

38+
39+
self.controls.clearSidebarLabel = new("LabelControl", {"TOPLEFT", self, "TOPLEFT"}, {425, 5, 150, 18}, "Right-click any Calcs value to pin/unpin it to the sidebar.")
40+
self.controls.clearSideBarPinnedStats = new("ButtonControl", {"TOPLEFT", self, "TOPLEFT"}, {270, 5, 150, 20}, "Clear Pinned Stats", function()
41+
if self.sidebarPinnedStats and #self.sidebarPinnedStats > 0 then
42+
self:ClearSidebarPinnedStats()
43+
return
44+
end
45+
46+
end)
47+
3848
-- Special section for skill/mode selection
3949
self:NewSection(3, "SkillSelect", 1, colorCodes.NORMAL, {{ defaultCollapsed = false, label = "View Skill Details", data = {
4050
{ label = "Socket Group", { controlName = "mainSocketGroup",
@@ -411,7 +421,7 @@ function CalcsTabClass:SetDisplayStat(displayData, pin)
411421
self.controls.breakdown:SetBreakdownData(displayData, pin)
412422
end
413423

414-
function CalcsTabClass:AddSidebarPinnedStat(displayData)
424+
function CalcsTabClass:ToggleSidebarPinnedStat(displayData)
415425
if not displayData or not displayData.format then
416426
return
417427
end
@@ -436,6 +446,14 @@ function CalcsTabClass:AddSidebarPinnedStat(displayData)
436446

437447
self.build:RefreshStatList()
438448
end
449+
450+
function CalcsTabClass:ClearSidebarPinnedStats()
451+
if not self.sidebarPinnedStats or #self.sidebarPinnedStats == 0 then
452+
return
453+
end
454+
wipeTable(self.sidebarPinnedStats)
455+
self.build:RefreshStatList()
456+
end
439457
function CalcsTabClass:CheckFlag(obj)
440458
local actor = self.input.showMinion and self.calcsEnv.minion or self.calcsEnv.player
441459
local skillFlags = actor.mainSkill.activeEffect.statSetCalcs.skillFlags

src/Modules/Build.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,7 @@ function buildMode:RefreshStatList()
20812081
if self.calcsTab.sidebarPinnedStats and #self.calcsTab.sidebarPinnedStats > 0 then
20822082
local actor = self.calcsTab.mainEnv.player
20832083
t_insert(statBoxList, { height = 10 })
2084-
t_insert(statBoxList, { height = 18, "^7Pinned:" })
2084+
t_insert(statBoxList, { height = 18, "^7Pinned Calcs:" })
20852085
for i, pinned in ipairs(self.calcsTab.sidebarPinnedStats) do
20862086
local label = pinned.pinnedLabel or ("Pinned " .. tostring(i))
20872087
local value = formatCalcStr(pinned.format, actor, pinned)

0 commit comments

Comments
 (0)