- 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,22 +1117,23 @@ end
-- Rokiyo: bar is the only required argument, scale & top are optional -- Rokiyo: bar is the only required argument, scale & top are optional
function IceBarElement.prototype:SetBarCoord(barFrame, scale, top) 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 not scale then scale = 0 end
scale = IceHUD:Clamp(scale, 0, 1)
if (self.moduleSettings.side == IceCore.Side.Left) then if scale == 0 then
min_x = 1 barFrame.bar:Hide()
max_x = 0
else else
min_x = 0 local min_y, max_y
max_x = 1 local offset_y = 0
end
if IceHUD:xor(self.moduleSettings.reverse, top) then if IceHUD:xor(self.moduleSettings.reverse, top) then
if self.moduleSettings.inverse == "INVERSE" then if self.moduleSettings.inverse == "INVERSE" then
min_y = 1 - scale min_y = 1 - scale
max_y = 1 max_y = 1
offset_y = 0 - (self.settings.barHeight * (1 - scale)) 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 else
min_y = 0 min_y = 0
max_y = scale max_y = scale
@ -1151,13 +1152,14 @@ function IceBarElement.prototype:SetBarCoord(barFrame, scale, top)
end end
end end
self:SetBarFramePoints(barFrame, 0, offset_y) if (self.moduleSettings.side == IceCore.Side.Left) then
barFrame.bar:SetTexCoord(min_x, max_x, min_y, max_y) barFrame.bar:SetTexCoord(1, 0, min_y, max_y)
barFrame:SetHeight(self.settings.barHeight * scale)
if scale == 0 then
barFrame.bar:Hide()
else 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() barFrame.bar:Show()
end end
end end

View File

@ -83,7 +83,7 @@ function SliceAndDice.prototype:GetDefaultSettings()
settings["lowerTextString"] = "" settings["lowerTextString"] = ""
settings["lowerTextVisible"] = false settings["lowerTextVisible"] = false
settings["hideAnimationSettings"] = true settings["hideAnimationSettings"] = true
settings["bAllowExpand"] = false settings["bAllowExpand"] = true
return settings return settings
end end
@ -296,28 +296,8 @@ function SliceAndDice.prototype:UpdateDurationBar(event, unit)
scale = 1 - scale scale = 1 - scale
end 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:SetVertexColor(self:GetColor("SliceAndDicePotential", self.alpha * self.moduleSettings.durationAlpha))
self.durationFrame.bar:Show() self:SetBarCoord(self.durationFrame, scale)
end
if sndEndTime < GetTime() then if sndEndTime < GetTime() then
self:SetBottomText1(self.moduleSettings.upperText .. "0 (" .. PotentialSnDDuration .. ")") self:SetBottomText1(self.moduleSettings.upperText .. "0 (" .. PotentialSnDDuration .. ")")

View File

@ -198,22 +198,13 @@ end
function IceThreat.prototype:CreateAggroBar() function IceThreat.prototype:CreateAggroBar()
self.aggroBar = self:BarFactory(self.aggroBar, "BACKGROUND","ARTWORK") 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") local r, g, b = self:GetColor("ThreatPullAggro")
if (self.settings.backgroundToggle) then if (self.settings.backgroundToggle) then
r, g, b = self:GetColor("CastCasting") r, g, b = self:GetColor("CastCasting")
end end
self.aggroBar.bar:SetVertexColor(r, g, b, self.moduleSettings.aggroAlpha) self.aggroBar.bar:SetVertexColor(r, g, b, self.moduleSettings.aggroAlpha)
self:SetBarCoord(self.aggroBar)
self:SetBarCoord(self.aggroBar, 0 , true)
end end
function IceThreat.prototype:CreateSecondThreatBar() function IceThreat.prototype:CreateSecondThreatBar()
@ -221,6 +212,7 @@ function IceThreat.prototype:CreateSecondThreatBar()
local r, g, b = self:GetColor("ThreatSecondPlace") local r, g, b = self:GetColor("ThreatSecondPlace")
self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha) self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha)
self:SetBarCoord(self.secondThreatBar) self:SetBarCoord(self.secondThreatBar)
end end
@ -338,28 +330,7 @@ function IceThreat.prototype:Update(unit)
self.aggroBarMulti = rangeMulti self.aggroBarMulti = rangeMulti
local pos = IceHUD:Clamp(1 - (1 / rangeMulti), 0, 1) local pos = IceHUD:Clamp(1 - (1 / rangeMulti), 0, 1)
local fromTop = not IceHUD:xor(self.moduleSettings.reverse, (self.moduleSettings.inverse == "INVERSE")) self:SetBarCoord(self.aggroBar, pos, true)
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)
--end --end
self:UpdateAlpha() self:UpdateAlpha()
@ -370,36 +341,14 @@ function IceThreat.prototype:UpdateSecondHighestThreatBar(secondHighestThreat, t
if secondHighestThreat <= 0 or not threatValue or threatValue == 0 then if secondHighestThreat <= 0 or not threatValue or threatValue == 0 then
self.secondThreatBar:Hide() self.secondThreatBar:Hide()
else 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") local r, g, b = self:GetColor("ThreatSecondPlace")
self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha * self.moduleSettings.secondPlaceThreatAlpha) self.secondThreatBar.bar:SetVertexColor(r, g, b, self.alpha * self.moduleSettings.secondPlaceThreatAlpha)
self.secondThreatBar:SetHeight(pos * self.settings.barHeight) local pos = IceHUD:Clamp(secondHighestThreat / threatValue, 0, 1)
self.secondThreatBar:Show() if self.moduleSettings.reverse then
pos = 1-pos
end
self:SetBarCoord(self.secondThreatBar, pos)
end end
end end