Add LayerPickerFrame skinning with Instance toggle
Strips the native tooltip-style backdrop pieces off the LayerPickerFrame button and applies the ElvUI backdrop/button style, gated by a new Instance checkbox in the Skins tab.
This commit is contained in:
@@ -8,3 +8,4 @@
|
||||
|
||||
core.lua
|
||||
Modules\ExtraActionBar.lua
|
||||
Modules\LayerPicker.lua
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
local E, L, V, P, G = unpack(ElvUI)
|
||||
local CoA = E:GetModule("CoA")
|
||||
|
||||
local BUTTON_NAME = "LayerPickerFrame"
|
||||
|
||||
local function SkinButton(button)
|
||||
if button.CoASkinned then return end
|
||||
button.CoASkinned = true
|
||||
|
||||
local name = button:GetName()
|
||||
local text = _G[name.."Text"]
|
||||
|
||||
button:StripTextures(true)
|
||||
button:CreateBackdrop("Default")
|
||||
button:StyleButton()
|
||||
|
||||
if text then
|
||||
text:FontTemplate()
|
||||
end
|
||||
end
|
||||
|
||||
local function TryHook()
|
||||
local button = _G[BUTTON_NAME]
|
||||
|
||||
if button and E.private.CoA.instance then
|
||||
SkinButton(button)
|
||||
end
|
||||
|
||||
return button ~= nil
|
||||
end
|
||||
|
||||
function CoA:InitializeLayerPicker()
|
||||
if TryHook() then return end
|
||||
|
||||
self.layerPickerTimer = self:ScheduleRepeatingTimer(function()
|
||||
if TryHook() then
|
||||
self:CancelTimer(self.layerPickerTimer)
|
||||
self.layerPickerTimer = nil
|
||||
end
|
||||
end, 0.5)
|
||||
end
|
||||
@@ -8,6 +8,7 @@ E.CoA = CoA
|
||||
|
||||
V.CoA = {
|
||||
extraActionBar = true,
|
||||
instance = true,
|
||||
}
|
||||
|
||||
local function getOptions()
|
||||
@@ -38,6 +39,12 @@ local function getOptions()
|
||||
name = "Extra Action Bar",
|
||||
desc = "Skin the ExtraActionBar frame.",
|
||||
},
|
||||
instance = {
|
||||
order = 3,
|
||||
type = "toggle",
|
||||
name = "Instance",
|
||||
desc = "Skin the LayerPickerFrame button.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -52,6 +59,10 @@ function CoA:Initialize()
|
||||
if self.InitializeExtraActionBar then
|
||||
self:InitializeExtraActionBar()
|
||||
end
|
||||
|
||||
if self.InitializeLayerPicker then
|
||||
self:InitializeLayerPicker()
|
||||
end
|
||||
end
|
||||
|
||||
local function InitializeCallback()
|
||||
|
||||
Reference in New Issue
Block a user