From d315ee3e3c9e5f2b9ce60e3b890e6029cf4a6a3c Mon Sep 17 00:00:00 2001 From: Parnic Date: Sat, 16 Oct 2010 03:07:19 +0000 Subject: [PATCH] - fixed bar text not properly hiding on bars that use RegisterUnitWatch to control visibility --- IceBarElement.lua | 20 ++++++++++++++++++++ modules/CustomHealth.lua | 4 ---- modules/FocusHealth.lua | 4 ---- modules/PetHealth.lua | 4 ---- modules/TargetHealth.lua | 4 ---- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index 0245f75..ecc2265 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -60,12 +60,32 @@ function IceBarElement.prototype:Enable() end self:RegisterFontStrings() + + -- allows frames that show/hide via RegisterUnitWatch to not show text when they shouldn't + self.frame:SetScript("OnHide", function() + if self.moduleSettings.textVisible["upper"] then + self.frame.bottomUpperText:Hide() + end + if self.moduleSettings.textVisible["upper"] then + self.frame.bottomLowerText:Hide() + end + end) + self.frame:SetScript("OnShow", function() + if self.moduleSettings.textVisible["upper"] then + self.frame.bottomUpperText:Show() + end + if self.moduleSettings.textVisible["upper"] then + self.frame.bottomLowerText:Show() + end + end) end function IceBarElement.prototype:Disable(core) IceBarElement.super.prototype.Disable(self, core) self.frame:SetScript("OnUpdate", nil) + self.frame:SetScript("OnHide", nil) + self.frame:SetScript("OnShow", nil) end diff --git a/modules/CustomHealth.lua b/modules/CustomHealth.lua index 0919d1f..cbded36 100644 --- a/modules/CustomHealth.lua +++ b/modules/CustomHealth.lua @@ -114,10 +114,6 @@ function IceCustomHealth.prototype:Enable(core) self:CreateFrame() self.scheduledEvent = self:ScheduleRepeatingTimer("Update", IceHUD.IceCore:UpdatePeriod()) - - if not IceHUD.IceCore:ShouldUseDogTags() then - self.frame:SetScript("OnHide", function() self:SetBottomText1("") self:SetBottomText2("") end) - end end function IceCustomHealth.prototype:Disable(core) diff --git a/modules/FocusHealth.lua b/modules/FocusHealth.lua index ef33776..b841589 100644 --- a/modules/FocusHealth.lua +++ b/modules/FocusHealth.lua @@ -258,10 +258,6 @@ function FocusHealth.prototype:Enable(core) -- for showing/hiding the frame based on unit visibility self.frame:SetAttribute("unit", self.unit) RegisterUnitWatch(self.frame) - - if not IceHUD.IceCore:ShouldUseDogTags() then - self.frame:SetScript("OnHide", function() self:SetBottomText1("") self:SetBottomText2("") end) - end end function FocusHealth.prototype:CreateBackground() diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index 668a62c..92a0b4a 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -70,10 +70,6 @@ function PetHealth.prototype:Enable(core) self.frame:SetAttribute("unit", self.unit) RegisterUnitWatch(self.frame) - if not IceHUD.IceCore:ShouldUseDogTags() then - self.frame:SetScript("OnHide", function() self:SetBottomText1("") self:SetBottomText2("") end) - end - self:CheckPet() end diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index c89ee3b..5e71925 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -646,10 +646,6 @@ function IceTargetHealth.prototype:Enable(core) self:Update(self.unit) RegisterUnitWatch(self.frame) - - if not IceHUD.IceCore:ShouldUseDogTags() then - self.frame:SetScript("OnHide", function() self:SetBottomText1("") self:SetBottomText2("") end) - end end