mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- user-submitted patch for an 'invert' option in addition to the 'reverse' option for all bars. now 'reverse' controls bar movement direction while 'invert' controls bar fill behavior http://www.wowace.com/addons/ice-hud/tickets/73-reversing-cast-bars-and-channels
This commit is contained in:
@ -64,6 +64,7 @@ function IceBarElement.prototype:GetDefaultSettings()
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 1
|
||||
settings["scale"] = 1
|
||||
settings["inverse"] = false
|
||||
settings["reverse"] = false
|
||||
settings["barFontSize"] = 12
|
||||
settings["lockUpperTextAlpha"] = true
|
||||
@ -166,6 +167,25 @@ function IceBarElement.prototype:GetOptions()
|
||||
order = 32
|
||||
}
|
||||
|
||||
opts["inverse"] =
|
||||
{
|
||||
type = 'toggle',
|
||||
name = 'Invert bar',
|
||||
desc = 'Filling behaviour of bar',
|
||||
get = function()
|
||||
return self.moduleSettings.inverse
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.inverse = value
|
||||
self:SetBarFramePoints()
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 32
|
||||
}
|
||||
|
||||
opts["reverse"] =
|
||||
{
|
||||
type = 'toggle',
|
||||
@ -545,7 +565,7 @@ end
|
||||
|
||||
function IceBarElement.prototype:SetBarFramePoints()
|
||||
self.barFrame:ClearAllPoints()
|
||||
if (self.moduleSettings.reverse) then
|
||||
if (self.moduleSettings.inverse) then
|
||||
self.barFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
|
||||
else
|
||||
self.barFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
|
||||
@ -768,11 +788,15 @@ function IceBarElement.prototype:SetScale(scale, force)
|
||||
self.CurrScale = IceHUD:Clamp(self:LerpScale(scale), 0, 1)
|
||||
|
||||
if force or oldScale ~= self.CurrScale then
|
||||
local scale = self.CurrScale
|
||||
if (self.moduleSettings.reverse) then
|
||||
scale = 1 - scale
|
||||
end
|
||||
if (self.moduleSettings.inverse) then
|
||||
min_y = 0;
|
||||
max_y = self.CurrScale;
|
||||
max_y = scale;
|
||||
else
|
||||
min_y = 1-self.CurrScale;
|
||||
min_y = 1-scale;
|
||||
max_y = 1;
|
||||
end
|
||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||
@ -781,7 +805,7 @@ function IceBarElement.prototype:SetScale(scale, force)
|
||||
self.barFrame.bar:SetTexCoord(0, 1, min_y, max_y)
|
||||
end
|
||||
|
||||
self.barFrame:SetHeight(self.settings.barHeight * self.CurrScale)
|
||||
self.barFrame:SetHeight(self.settings.barHeight * scale)
|
||||
|
||||
if self.CurrScale == 0 then
|
||||
self.barFrame.bar:Hide()
|
||||
|
@ -65,6 +65,7 @@ function IceCastBar.prototype:GetDefaultSettings()
|
||||
settings["displayAuraIcon"] = false
|
||||
settings["auraIconXOffset"] = 40
|
||||
settings["auraIconYOffset"] = 0
|
||||
settings["reverseChannel"] = true
|
||||
|
||||
return settings
|
||||
end
|
||||
@ -178,6 +179,23 @@ function IceCastBar.prototype:GetOptions()
|
||||
order = 53,
|
||||
}
|
||||
|
||||
opts["reverseChannel"] = {
|
||||
type = 'toggle',
|
||||
name = "Reverse channel direction",
|
||||
desc = "Whether or not to reverse the direction of a channel's castbar",
|
||||
get = function()
|
||||
return self.moduleSettings.reverseChannel
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.reverseChannel = v
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
usage = "<whether or not to reverse the direction of a channel's castbar>",
|
||||
order = 32.5,
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
|
||||
@ -233,7 +251,7 @@ function IceCastBar.prototype:OnUpdate()
|
||||
local remainingTime = self.actionStartTime + self.actionDuration - time
|
||||
local scale = 1 - (self.actionDuration ~= 0 and remainingTime / self.actionDuration or 0)
|
||||
|
||||
if (self.action == IceCastBar.Actions.Channel) then
|
||||
if (self.moduleSettings.reverseChannel and self.action == IceCastBar.Actions.Channel) then
|
||||
scale = self.actionDuration ~= 0 and remainingTime / self.actionDuration or 0
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user