964f88559d
The talent window, the Vanity and Wardrobe windows it switches between and the tab row along its bottom are one feature to the player, so they get one entry in the Skins tree and one master switch gating all three Initialize calls together. Skinning one of them without the others reads as a bug. Scale is a slider per window, 0.5 to 1.5, applied as a multiplier on the existing scale rather than an absolute -- the three don't ship at the same size (the vanity store's frame runs about 9% larger than the others), and that is the server's choice to keep. A setting of 1.0 leaves everything exactly as it was. The scale is set on Collections, not on the window itself. All three windows and the tab row are its children, and it is the only one of them with mouse enabled -- it is what the player drags. Scaling a window directly left the drag target at full size, so a shrunk window had to be grabbed by clicking outside itself, and the tab row, not being a child of any window, kept whichever size the first-opened one gave it. Scaling the container moves its hit area with it and the tabs follow as children.
99 lines
3.2 KiB
Lua
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()
|
|
S:HandleButton(_G[FRAME_NAME.."ActivateStoreButton"])
|
|
S:HandleButton(_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
|