- integrated a user-submitted cleanup of how we were managing bar texture clipping after 3.3.3's mess. this binds the texture to the frame and calls SetHeight on the frame instead of the texture as well as unifies the "reverse direction" behavior a bit

This commit is contained in:
Parnic
2010-03-30 23:35:49 +00:00
parent 014fc5fa18
commit 87cf1d74c6

View File

@ -176,6 +176,12 @@ function IceBarElement.prototype:GetOptions()
end, end,
set = function(value) set = function(value)
self.moduleSettings.reverse = value self.moduleSettings.reverse = value
self.barFrame:ClearAllPoints()
if (self.moduleSettings.reverse) then
self.barFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else
self.barFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
end
self:Redraw() self:Redraw()
end, end,
disabled = function() disabled = function()
@ -642,31 +648,36 @@ function IceBarElement.prototype:CreateBar()
end end
self.barFrame:SetFrameStrata("LOW") self.barFrame:SetFrameStrata("LOW")
self.barFrame:ClearAllPoints()
if (self.moduleSettings.reverse) then
self.barFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT")
else
self.barFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT")
end
self.barFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.barFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0))
self.barFrame:SetHeight(self.settings.barHeight) self.barFrame:SetHeight(self.settings.barHeight)
if not (self.barFrame.bar) then if not (self.barFrame.bar) then
self.barFrame.bar = self.barFrame:CreateTexture(nil, "LOW") self.barFrame.bar = self.barFrame:CreateTexture(nil, "LOW")
end end
self.barFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture()) self.barFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
self.barFrame.bar:SetBlendMode(self.settings.barBlendMode) self.barFrame.bar:SetBlendMode(self.settings.barBlendMode)
self.barFrame.bar:ClearAllPoints() self.barFrame.bar:SetAllPoints(self.barFrame)
self.barFrame.bar:SetPoint("BOTTOMLEFT",self.barFrame,"BOTTOMLEFT") if (self.moduleSettings.reverse) then
self.barFrame.bar:SetPoint("BOTTOMRIGHT",self.barFrame,"BOTTOMRIGHT") min_y = 0;
max_y = self.CurrScale;
if (self.moduleSettings.side == IceCore.Side.Left) then
self.barFrame.bar:SetTexCoord(1, 0, 1-self.CurrScale, 1)
else else
self.barFrame.bar:SetTexCoord(0, 1, 1-self.CurrScale, 1) min_y = 1-self.CurrScale;
max_y = 1;
end
if (self.moduleSettings.side == IceCore.Side.Left) then
self.barFrame.bar:SetTexCoord(1, 0, min_y, max_y)
else
self.barFrame.bar:SetTexCoord(0, 1, min_y, max_y)
end end
self.barFrame.bar:SetHeight(self.settings.barHeight*self.CurrScale)
self:UpdateBar(1, "undef") self:UpdateBar(1, "undef")
self.barFrame:ClearAllPoints()
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
end end
@ -772,13 +783,9 @@ function IceBarElement.prototype:SetScale(texture, scale)
if oldScale ~= self.CurrScale then if oldScale ~= self.CurrScale then
if (texture == self.barFrame.bar) then if (texture == self.barFrame.bar) then
if (self.moduleSettings.reverse) then if (self.moduleSettings.reverse) then
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, (self.settings.barHeight - (self.CurrScale * self.settings.barHeight)))
min_y = 0; min_y = 0;
max_y = self.CurrScale; max_y = self.CurrScale;
else else
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
min_y = 1-self.CurrScale; min_y = 1-self.CurrScale;
max_y = 1; max_y = 1;
end end
@ -788,7 +795,8 @@ function IceBarElement.prototype:SetScale(texture, scale)
else else
texture:SetTexCoord(0, 1, min_y, max_y) texture:SetTexCoord(0, 1, min_y, max_y)
end end
self.barFrame.bar:SetHeight(self.settings.barHeight * self.CurrScale)
self.barFrame:SetHeight(self.settings.barHeight * self.CurrScale)
if self.CurrScale == 0 then if self.CurrScale == 0 then
self.barFrame.bar:Hide() self.barFrame.bar:Hide()