Files
ElvUI_CoA/Modules/VanityFrame.lua
T
Narcasung d2e55eb3cb Stop disabled buttons taking the hover border colour
S:HandleButton ends with an unconditional OnEnter/OnLeave pair that swaps
the border to the value colour and back, and neither handler looks at
IsEnabled. A disabled button still fires both scripts on this client, so
the greyed Activate button, Save changes with nothing pending and Purchase
with nothing selected all lit up under the cursor and read as clickable.

HookScript can't be undone, but handlers fire in registration order, so a
hook registered after HandleButton runs last and has the final say on the
colour. Skin:Button wraps HandleButton with that hook, and every call site
in the plugin now goes through it, so the correction is inherited rather
than repeated per module.

The Activate button carries the border from its own update as well:
activating a spec disables it under the very cursor that just clicked it,
and OnEnter has been and gone by then, so nothing else would put the border
back until the pointer moved off.

Skin:IsEnabled hoists the 0/1-to-boolean normalisation this client needs
out of UpdateActivateState, which held the only copy of it.
2026-08-18 16:30:27 +02:00

99 lines
3.2 KiB
Lua

local E, L, V, P, G = unpack(ElvUI)
local S = E:GetModule("Skins")
local CoA = E:GetModule("CoA")
local Skin = CoA.Skin
local FRAME_NAME = "StoreCollectionFrame"
-- Confirmed live by probing size/position: these two OVERLAY "Portrait2"
-- regions sit at the currency counters (aligned with SPCounterHintButton and
-- DPCounterHintButton), not at the top-left corner. An earlier version of
-- this matched them as the portrait and stripped them, which blanked the
-- counter badges instead. Whatever the real top-left portrait is hasn't been
-- identified yet -- it isn't among StoreCollectionFrame's own regions or
-- children -- so nothing removes it for now.
-- Standard UIPanelButtonTemplate art (FontString + Normal/Pushed/Disabled/
-- Highlight textures), confirmed by probe -- S:HandleButton's own texture
-- clearing handles these directly, no manual stripping needed.
local function SkinActionButtons()
Skin:Button(_G[FRAME_NAME.."ActivateStoreButton"])
Skin:Button(_G[FRAME_NAME.."BuyStoreButton"])
end
local function SkinSearchBox()
S:HandleEditBox(_G[FRAME_NAME.."SearchBox"])
end
-- The filter pill and its popout are the shared dropdown widget; see
-- Skinning.lua for why S:HandleButton alone can't clear it.
local function SkinDropdown()
Skin:Dropdown(_G[FRAME_NAME.."Dropdown"], _G[FRAME_NAME.."DropdownMenu"])
end
-- Neither pager button is named (both are anonymous children of
-- CollectionList), so direction is worked out from their own anchor offset
-- rather than a name match, and re-checked on every pass instead of cached --
-- cheap, and self-corrects if the two ever come back in a different order.
local function SkinPagerArrows()
local list = _G[FRAME_NAME.."CollectionList"]
if not list then return end
local a, b = select(3, list:GetChildren()), select(4, list:GetChildren())
if not (a and b and a:GetObjectType() == "Button" and b:GetObjectType() == "Button") then return end
local _, _, _, ax = a:GetPoint()
local _, _, _, bx = b:GetPoint()
local prevButton, nextButton = a, b
if bx and ax and bx < ax then
prevButton, nextButton = b, a
end
S:HandleNextPrevButton(prevButton, "left")
S:HandleNextPrevButton(nextButton, "right")
end
local function SkinContents()
-- Scale is set on the shared container while this window is the open one,
-- which carries the tab row along with it (see Skinning.lua).
Skin:ApplyWindowScale("vanityScale")
Skin:CollectionTabs(_G[FRAME_NAME])
Skin:Title(_G[FRAME_NAME.."TitleText"])
Skin:CloseButton(_G[FRAME_NAME.."CloseButton"])
SkinActionButtons()
SkinSearchBox()
SkinDropdown()
SkinPagerArrows()
end
local function SkinFrame(frame)
if not frame.CoASkinned then
frame.CoASkinned = true
-- Templated without stripping, unlike the talent and wardrobe frames:
-- the currency counters are drawn as regions of the frame itself (see
-- the note at the top of this file), so a strip blanks them.
Skin:Panel(frame, true)
frame:HookScript("OnShow", SkinContents)
end
SkinContents()
end
local function TryHook()
local frame = _G[FRAME_NAME]
if not frame then return false end
SkinFrame(frame)
return true
end
function CoA:InitializeVanityFrame()
if not E.private.skins.blizzard.enable then return end
Skin:OnFrameAvailable(TryHook)
end