mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-01 19:30:00 +00:00
actionbar: entire rewrite of the actionbars
Final squashed commit of the actionbars. Ready for master. Config migration is now armed, you can't go back without backups.
This commit is contained in:
+19
-5
@@ -814,11 +814,12 @@ function pfUI.api.BarButtonAnchor(button,basename,buttonindex,barsize,formfactor
|
||||
return button._anchor
|
||||
end
|
||||
|
||||
-- [ Create Autohide ] --
|
||||
-- [ Enable Autohide ] --
|
||||
-- 'frame' the frame that should be hidden
|
||||
function pfUI.api.CreateAutohide(frame)
|
||||
function pfUI.api.EnableAutohide(frame, timeout)
|
||||
if not frame then return end
|
||||
frame.hover = CreateFrame("Frame", frame:GetName() .. "Autohide", frame)
|
||||
|
||||
frame.hover = frame.hover or CreateFrame("Frame", frame:GetName() .. "Autohide", frame)
|
||||
frame.hover:SetParent(frame)
|
||||
frame.hover:SetAllPoints(frame)
|
||||
frame.hover.parent = frame
|
||||
@@ -828,20 +829,33 @@ function pfUI.api.CreateAutohide(frame)
|
||||
this:Hide()
|
||||
end)
|
||||
|
||||
local timeout = timeout
|
||||
frame.hover:SetScript("OnUpdate", function()
|
||||
if MouseIsOver(this, 10, -10, -10, 10) then
|
||||
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
|
||||
this.activeTo = GetTime() + timeout
|
||||
this.parent:SetAlpha(1)
|
||||
elseif this.activeTo then
|
||||
if this.activeTo < GetTime() and this.parent:GetAlpha() > 0 then
|
||||
this.parent:SetAlpha(this.parent:GetAlpha() - 0.1)
|
||||
end
|
||||
else
|
||||
this.activeTo = GetTime() + tonumber(pfUI_config.bars.hide_time)
|
||||
this.activeTo = GetTime() + timeout
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- [ Disable Autohide ] --
|
||||
-- 'frame' the frame that should get the autohide removed
|
||||
function pfUI.api.DisableAutohide(frame)
|
||||
if not frame then return end
|
||||
if not frame.hover then return end
|
||||
|
||||
frame.hover:UnregisterAllEvents()
|
||||
frame.hover:SetScript("OnUpdate", nil)
|
||||
frame.hover:Hide()
|
||||
frame:SetAlpha(1)
|
||||
end
|
||||
|
||||
-- [ GetColoredTime ] --
|
||||
-- 'remaining' the time in seconds that should be converted
|
||||
-- return a colored string including a time unit (m/h/d)
|
||||
|
||||
Reference in New Issue
Block a user