- Fixed Threat module's aggro bar positioning incorrectly

- Fixed combining expand & reverse modes causing bars to position incorrectly.
- All empty bars now skip resizing calculations and just Hide() immediately.
- Threat & SnD modules now use the new bar resizing system.
- Enabled expanding fill for SnD module
This commit is contained in:
rokiyo
2010-11-03 17:23:31 +00:00
parent 2b3f606f20
commit 99e8b651d3
3 changed files with 50 additions and 119 deletions

View File

@ -1117,47 +1117,49 @@ end
-- Rokiyo: bar is the only required argument, scale & top are optional
function IceBarElement.prototype:SetBarCoord(barFrame, scale, top)
local min_x, max_x, min_y, max_y, offset_y
if not scale then scale = 0 end
if (self.moduleSettings.side == IceCore.Side.Left) then
min_x = 1
max_x = 0
else
min_x = 0
max_x = 1
end
if IceHUD:xor(self.moduleSettings.reverse, top) then
if self.moduleSettings.inverse == "INVERSE" then
min_y = 1 - scale
max_y = 1
offset_y = 0 - (self.settings.barHeight * (1 - scale))
else
min_y = 0
max_y = scale
offset_y = (self.settings.barHeight * (1 - scale))
end
else
if self.moduleSettings.inverse == "INVERSE" then
min_y = 0;
max_y = scale;
elseif self.moduleSettings.inverse == "EXPAND" then
min_y = 0.5 - (scale * 0.5);
max_y = 0.5 + (scale * 0.5);
else
min_y = 1-scale;
max_y = 1;
end
end
self:SetBarFramePoints(barFrame, 0, offset_y)
barFrame.bar:SetTexCoord(min_x, max_x, min_y, max_y)
barFrame:SetHeight(self.settings.barHeight * scale)
scale = IceHUD:Clamp(scale, 0, 1)
if scale == 0 then
barFrame.bar:Hide()
else
local min_y, max_y
local offset_y = 0
if IceHUD:xor(self.moduleSettings.reverse, top) then
if self.moduleSettings.inverse == "INVERSE" then
min_y = 1 - scale
max_y = 1
offset_y = 0 - (self.settings.barHeight * (1 - scale))
elseif self.moduleSettings.inverse == "EXPAND" then
min_y = 0.5 - (scale * 0.5);
max_y = 0.5 + (scale * 0.5);
else
min_y = 0
max_y = scale
offset_y = (self.settings.barHeight * (1 - scale))
end
else
if self.moduleSettings.inverse == "INVERSE" then
min_y = 0;
max_y = scale;
elseif self.moduleSettings.inverse == "EXPAND" then
min_y = 0.5 - (scale * 0.5);
max_y = 0.5 + (scale * 0.5);
else
min_y = 1-scale;
max_y = 1;
end
end
if (self.moduleSettings.side == IceCore.Side.Left) then
barFrame.bar:SetTexCoord(1, 0, min_y, max_y)
else
barFrame.bar:SetTexCoord(0, 1, min_y, max_y)
end
self:SetBarFramePoints(barFrame, 0, offset_y)
barFrame:SetHeight(self.settings.barHeight * scale)
barFrame.bar:Show()
end
end

View File

@ -83,7 +83,7 @@ function SliceAndDice.prototype:GetDefaultSettings()
settings["lowerTextString"] = ""
settings["lowerTextVisible"] = false
settings["hideAnimationSettings"] = true
settings["bAllowExpand"] = false
settings["bAllowExpand"] = true
return settings
end
@ -296,28 +296,8 @@ function SliceAndDice.prototype:UpdateDurationBar(event, unit)
scale = 1 - scale
end
local min_y, max_y
if (self.moduleSettings.inverse == "INVERSE") then
min_y = 0
max_y = scale
else
min_y = 1-scale
max_y = 1
end
if (self.moduleSettings.side == IceCore.Side.Left) then
self.durationFrame.bar:SetTexCoord(1, 0, min_y, max_y)
else
self.durationFrame.bar:SetTexCoord(0, 1, min_y, max_y)
end
self.durationFrame:SetHeight(self.settings.barHeight * scale)
if scale == 0 then
self.durationFrame.bar:Hide()
else
self.durationFrame.bar:SetVertexColor(self:GetColor("SliceAndDicePotential", self.alpha * self.moduleSettings.durationAlpha))
self.durationFrame.bar:Show()
end
self.durationFrame.bar:SetVertexColor(self:GetColor("SliceAndDicePotential", self.alpha * self.moduleSettings.durationAlpha))
self:SetBarCoord(self.durationFrame, scale)
if sndEndTime < GetTime() then
self:SetBottomText1(self.moduleSettings.upperText .. "0 (" .. PotentialSnDDuration .. ")")

View File

@ -198,22 +198,13 @@ end
function IceThreat.prototype:CreateAggroBar()
self.aggroBar = self:BarFactory(self.aggroBar, "BACKGROUND","ARTWORK")
-- Rokiyo: TODO: modify IceBarElement:SetBarFramePoints() to handle this behaviour.
local aggroTop = not IceHUD:xor(self.moduleSettings.reverse, (self.moduleSettings.inverse == "INVERSE"))
self.aggroBar:ClearAllPoints()
if aggroTop then
self.aggroBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else
self.aggroBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
end
-- End of IceBarElement:SetBarFramePoints() override.
local r, g, b = self:GetColor("ThreatPullAggro")
if (self.settings.backgroundToggle) then
r, g, b = self:GetColor("CastCasting")
end
self.aggroBar.bar:SetVertexColor(r, g, b, self.moduleSettings.aggroAlpha)
self:SetBarCoord(self.aggroBar)
self:SetBarCoord(self.aggroBar, 0 , true)
end
function IceThreat.prototype:CreateSecondThreatBar()
@ -221,6 +212,7 @@ function IceThreat.prototype:CreateSecondThreatBar()
local r, g, b = self:GetColor("ThreatSecondPlace")
self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha)
self:SetBarCoord(self.secondThreatBar)
end
@ -338,28 +330,7 @@ function IceThreat.prototype:Update(unit)
self.aggroBarMulti = rangeMulti
local pos = IceHUD:Clamp(1 - (1 / rangeMulti), 0, 1)
local fromTop = not IceHUD:xor(self.moduleSettings.reverse, (self.moduleSettings.inverse == "INVERSE"))
local min_y = 0
local max_y = pos
if not fromTop then
min_y = 1-pos
max_y = 1
end
if ( self.moduleSettings.side == IceCore.Side.Left ) then
self.aggroBar.bar:SetTexCoord(1, 0, min_y, max_y)
else
self.aggroBar.bar:SetTexCoord(0, 1, min_y, max_y)
end
if pos == 0 then
self.aggroBar.bar:Hide()
else
self.aggroBar.bar:Show()
end
self.aggroBar:SetHeight(self.settings.barHeight * pos)
self:SetBarCoord(self.aggroBar, pos, true)
--end
self:UpdateAlpha()
@ -370,36 +341,14 @@ function IceThreat.prototype:UpdateSecondHighestThreatBar(secondHighestThreat, t
if secondHighestThreat <= 0 or not threatValue or threatValue == 0 then
self.secondThreatBar:Hide()
else
local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1)
if self.moduleSettings.reverse then
pos = 1-pos
end
if (self.moduleSettings.reverse) then
pos = 1 - pos
end
local min_y, max_y
if (self.moduleSettings.inverse == "INVERSE") then
min_y = 0
max_y = pos
else
min_y = 1-pos
max_y = 1
end
if ( self.moduleSettings.side == IceCore.Side.Left ) then
self.secondThreatBar.bar:SetTexCoord(1, 0, min_y, max_y)
else
self.secondThreatBar.bar:SetTexCoord(0, 1, min_y, max_y)
end
local r, g, b = self:GetColor("ThreatSecondPlace")
self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha * self.moduleSettings.secondPlaceThreatAlpha)
self.secondThreatBar:SetHeight(pos * self.settings.barHeight)
self.secondThreatBar:Show()
local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1)
if self.moduleSettings.reverse then
pos = 1-pos
end
self:SetBarCoord(self.secondThreatBar, pos)
end
end