Commit 6d3c46cd authored by Blazeflack's avatar Blazeflack
Browse files

Preliminary changes to actionbar desaturation.

Waiting for WoW to install so I can test it properly.
parent 49285c6a
......@@ -1128,8 +1128,11 @@ function AB:LAB_ButtonUpdate(button)
end
LAB.RegisterCallback(AB, "OnButtonUpdate", AB.LAB_ButtonUpdate)
local function OnCooldownUpdate(event, button, start, duration)
local function OnCooldownUpdate(_, button, start, duration)
if not button._state_type == "action" then return; end
if start and duration > 1.5 then
button.saturationLocked = true --Lock any new actions that are created after we activated desaturation
button.icon:SetDesaturated(true)
else
button.icon:SetDesaturated(false)
......@@ -1138,17 +1141,21 @@ end
function AB:ToggleDesaturation(value)
value = value or self.db.desaturateOnCooldown
if value then
for button in pairs(LAB:GetAllButtons()) do
LAB.RegisterCallback(AB, "OnCooldownUpdate", OnCooldownUpdate)
local start, duration
for button in pairs(LAB.ActionButtons) do
button.saturationLocked = true
start, duration = button:GetCooldown()
OnCooldownUpdate(nil, button, start, duration)
end
LAB.RegisterCallback(AB, "OnCooldownUpdate", OnCooldownUpdate)
else
for button in pairs(LAB:GetAllButtons()) do
LAB.UnregisterCallback(AB, "OnCooldownUpdate")
for button in pairs(LAB.ActionButtons) do
button.saturationLocked = nil
button.icon:SetDesaturated(false)
end
LAB.UnregisterCallback(AB, "OnCooldownUpdate")
end
end
......@@ -1204,6 +1211,8 @@ function AB:Initialize()
LOCK_ACTIONBAR = (self.db.lockActionBars == true and "1" or "0") --Keep an eye on this, in case it taints
SpellFlyout:HookScript("OnShow", SetupFlyoutButton)
self:ToggleDesaturation()
end
local function InitializeCallback()
......
......@@ -984,6 +984,7 @@ function E:UpdateAll(ignoreInstall)
AB:UpdateMicroPositionDimensions()
AB:Extra_SetAlpha()
AB:Extra_SetScale()
AB:ToggleDesaturation()
local bags = E:GetModule('Bags');
bags.db = self.db.bags
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment