Add a tooltip stat-diff toggle to Items tab (#7269)

* Update ItemsTab.lua

* improvements as requested

* change to early-return

* save/load setting

* update `ctrl + d` shortcut info

to reflect changes made to Items tab
This commit is contained in:
Nighty
2024-07-22 05:56:31 +10:00
committed by GitHub
parent b2f5081c59
commit b6a18ce46e
2 changed files with 16 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ Ctrl + 7 Jump to party tab
Ctrl + I Jump to import tab
Ctrl + A Select all
Ctrl + C Copy
Ctrl + D Toggle stat diff display (Passive Tree tab / Items tab)
Ctrl + F Show find / search box (e.g. unique item / tree)
Ctrl + M Manage Trees (Tree tab only)
Ctrl + N New build (in build selection menu)
@@ -52,7 +53,6 @@ Passive Tree Shortcuts:
Ctrl Hide tooltips while held
P Toggle node power
Ctrl + D Toggle stat diff display
PgUp/PgDn/MWheel Zoom in / out (hold with shift to increase the amount of zoom x 3)
Ctrl + LMB Zoom in on mouse cursor position
Hold Shift Enable "path trace mode"

View File

@@ -59,6 +59,8 @@ local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Contro
self.items = { }
self.itemOrderList = { }
self.showStatDifferences = true
-- PoB Trader class initialization
self.tradeQuery = new("TradeQuery", self)
@@ -1011,6 +1013,9 @@ function ItemsTabClass:Load(xml, dbFileName)
self.itemSetOrderList[1] = 1
end
self:SetActiveItemSet(tonumber(xml.attrib.activeItemSet) or 1)
if xml.attrib.showStatDifferences then
self.showStatDifferences = xml.attrib.showStatDifferences == "true"
end
self:ResetUndo()
self.build:SyncLoadouts()
end
@@ -1019,6 +1024,7 @@ function ItemsTabClass:Save(xml)
xml.attrib = {
activeItemSet = tostring(self.activeItemSetId),
useSecondWeaponSet = tostring(self.activeItemSet.useSecondWeaponSet),
showStatDifferences = tostring(self.showStatDifferences),
}
for _, id in ipairs(self.itemOrderList) do
local item = self.items[id]
@@ -1173,6 +1179,9 @@ function ItemsTabClass:Draw(viewPort, inputEvents)
self:SelectControl(self.controls.uniqueDB.controls.search)
self.controls.selectDB.selIndex = 1
end
elseif event.key == "d" and IsKeyDown("CTRL") then
self.showStatDifferences = not self.showStatDifferences
self.build.buildFlag = true
end
end
end
@@ -3388,6 +3397,11 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
tooltip:AddSeparator(14)
-- Stat differences
if not self.showStatDifferences then
tooltip:AddSeparator(14)
tooltip:AddLine(14, colorCodes.TIP.."Tip: Press Ctrl+D to enable the display of stat differences.")
return
end
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator()
if base.flask then
-- Special handling for flasks
@@ -3645,6 +3659,7 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
end
end
end
tooltip:AddLine(14, colorCodes.TIP.."Tip: Press Ctrl+D to disable the display of stat differences.")
if launch.devModeAlt then
-- Modifier debugging info