Added support for specifying the fade-out alpha in the custom visibility header

Example:
[mod:ctrl]fade:10;[mod:alt]fade:50;[mod:shift]fade:80;show

0 is completly transparent, while 100 is completly opaque.
This commit is contained in:
Hendrik Leppkes
2008-11-01 17:33:38 +01:00
parent 9adffaf957
commit 9d7ed64417
+12 -3
View File
@@ -284,7 +284,13 @@ function Bar:ControlFadeOut()
self:SetAlpha(self.config.alpha)
self.faded = nil
elseif not self.faded and not MouseIsOver(self) then
self:SetAlpha(self.config.fadeoutalpha)
local fade = self:GetAttribute("fade")
if tonumber(fade) then
fade = min(max(fade, 0), 100) / 100
self:SetAlpha(fade)
else
self:SetAlpha(self.config.fadeoutalpha)
end
self.faded = true
end
end
@@ -306,9 +312,12 @@ function Bar:InitVisibilityDriver(returnOnly)
self.hidedriver = {}
self:SetAttribute("_onstate-vis", [[
if newstate == "show" or newstate == "fade" then
if newstate == "show" then
self:Show()
self:SetAttribute("fade", (newstate == "fade"))
self:SetAttribute("fade", false)
elseif strsub(newstate, 1, 4) == "fade" then
self:Show()
self:SetAttribute("fade", (newstate == "fade") and true or strsub(newstate, 6))
elseif newstate == "hide" then
self:Hide()
end