Skip to content
Merged
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
38 changes: 34 additions & 4 deletions src/Classes/CompareTab.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,16 @@ function CompareTabClass:Draw(viewPort, inputEvents)
end

self:DrawControls(viewPort)
if self.compareViewMode == "CONFIG" and compareEntry then
self:DrawConfig(contentVP, compareEntry, true)
self:DrawControlList(viewPort, {
self.controls.copyConfigBtn,
self.controls.configToggleBtn,
self.controls.configSearchEdit,
self.controls.configPrimarySetLabel,
self.controls.configPrimarySetSelect,
})
end
if drawingTree then
SetDrawLayer(0)
end
Expand All @@ -1859,6 +1869,17 @@ end
-- DRAW HELPERS
-- ============================================================

function CompareTabClass:DrawControlList(viewPort, controls)
local noTooltip = function(control)
return self.selControl and self.selControl.hasFocus and self.selControl ~= control
end
for _, control in ipairs(controls) do
if control:IsShown() and control.Draw then
control:Draw(viewPort, noTooltip(control))
end
end
end

-- Pre-draw tree header/footer backgrounds and position tree controls.
-- Must run before ProcessControlsInput so controls render on top of backgrounds.
function CompareTabClass:LayoutTreeView(contentVP, compareEntry)
Expand Down Expand Up @@ -2176,6 +2197,7 @@ function CompareTabClass:LayoutConfigView(contentVP, compareEntry)
local scrollTopAbs = contentVP.y + fixedHeaderHeight
local scrollBottomAbs = contentVP.y + contentVP.height
local ctrlH = rowHeight
local mouseClipRect = { contentVP.x, scrollTopAbs, contentVP.width, scrollBottomAbs - scrollTopAbs }
for _, sec in ipairs(sectionLayout) do
local sectionAbsX = contentVP.x + sec.x
local rowY = sec.y + sectionInnerPad
Expand All @@ -2187,11 +2209,13 @@ function CompareTabClass:LayoutConfigView(contentVP, compareEntry)
ci.compareControl.y = contentVP.y + fixedHeaderHeight + rowY - self.scrollY
local shownFn = function()
local ay = ci.primaryControl.y
return ay >= scrollTopAbs and ay + ctrlH <= scrollBottomAbs
return ay + ctrlH > scrollTopAbs and ay < scrollBottomAbs
and self.compareViewMode == "CONFIG" and self:GetActiveCompare() ~= nil
end
ci.primaryControl.shown = shownFn
ci.compareControl.shown = shownFn
ci.primaryControl.mouseClipRect = mouseClipRect
ci.compareControl.mouseClipRect = mouseClipRect
rowY = rowY + rowHeight
end
end
Expand Down Expand Up @@ -3959,7 +3983,7 @@ function CompareTabClass:DrawItems(vp, compareEntry, inputEvents)
-- Draw item tooltip on hover (compact mode only, on top of everything)
SetViewport()
local maxTooltipWidth = m_min(600, m_max(260, vp.width - 24))
if hoverItem and hoverItemsTab then
if not main.popups[1] and hoverItem and hoverItemsTab then
self.itemTooltip:Clear()
hoverItemsTab:AddItemTooltip(self.itemTooltip, hoverItem, nil, nil, maxTooltipWidth)
SetDrawLayer(nil, 100)
Expand All @@ -3968,7 +3992,7 @@ function CompareTabClass:DrawItems(vp, compareEntry, inputEvents)
end

-- Draw stat comparison tooltip when hovering Equip button
if hoverEquipItem and hoverEquipSlotName and not hoverItem then
if not main.popups[1] and hoverEquipItem and hoverEquipSlotName and not hoverItem then
self.itemTooltip:Clear()
self.itemTooltip.maxWidth = maxTooltipWidth
local calcFunc, calcBase = self.calcs.getMiscCalculator(self.primaryBuild)
Expand Down Expand Up @@ -4909,7 +4933,7 @@ end
-- ============================================================
-- CONFIG VIEW
-- ============================================================
function CompareTabClass:DrawConfig(vp, compareEntry)
function CompareTabClass:DrawConfig(vp, compareEntry, headerOnly)
local rowHeight = LAYOUT.configRowHeight
local columnHeaderHeight = LAYOUT.configColumnHeaderHeight
local fixedHeaderHeight = LAYOUT.configFixedHeaderHeight
Expand All @@ -4919,6 +4943,8 @@ function CompareTabClass:DrawConfig(vp, compareEntry)

-- Fixed header area: row 1 = buttons, row 2 = search/dropdowns, then column headers + separator
SetViewport(vp.x, vp.y, vp.width, fixedHeaderHeight)
SetDrawColor(0.05, 0.05, 0.05)
DrawImage(nil, 0, 0, vp.width, fixedHeaderHeight)
-- Controls are drawn by ControlHost (positioned in LayoutConfigView)
local colHeaderY = 54
SetDrawColor(1, 1, 1)
Expand All @@ -4930,6 +4956,10 @@ function CompareTabClass:DrawConfig(vp, compareEntry)
colorCodes.WARNING .. (compareEntry.label or "Compare Build"))
SetDrawColor(0.5, 0.5, 0.5)
DrawImage(nil, 4, colHeaderY + columnHeaderHeight + 4, vp.width - 8, 2)
if headerOnly then
SetViewport()
return
end

-- Scrollable content area (clipped below fixed header)
local scrollH = vp.height - fixedHeaderHeight
Expand Down
12 changes: 11 additions & 1 deletion src/Classes/ControlHost.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,17 @@ end
function ControlHostClass:GetMouseOverControl()
for _, control in pairs(self.controls) do
if control.IsMouseOver and control:IsMouseOver() then
return control
local clip = control.mouseClipRect
if type(clip) == "function" then
clip = clip(control)
end
if not clip then
return control
end
local cursorX, cursorY = GetCursorPos()
if cursorX >= clip[1] and cursorY >= clip[2] and cursorX < clip[1] + clip[3] and cursorY < clip[2] + clip[4] then
return control
end
end
end
end
Expand Down
Loading