From 73cc17927ec2be561aa1b24fb6634f2e9291a381 Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 13 Sep 2010 13:54:38 +0000 Subject: [PATCH] - minor optimization of frame rotation by un-registering the event listening for animation completion after it has done its job - made GCD module animation smooth by utilizing the existing animation system instead of trying to run another repeating timer over the top --- IceBarElement.lua | 2 +- modules/GlobalCoolDown.lua | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index 7bfe952..877b4a8 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -1231,10 +1231,10 @@ function IceBarElement.prototype:RotateFrame(frame) rot:SetDuration(0.001) rot:SetDegrees(-90) rot:SetOrigin("BOTTOMLEFT", 0, 0) - rot:SetScript("OnUpdate", function(anim) if anim:GetProgress() >= 1 then anim:Pause() end end) grp.rot = rot frame.anim = grp end + frame.anim.rot:SetScript("OnUpdate", function(anim) if anim:GetProgress() >= 1 then anim:Pause() anim:SetScript("OnUpdate", nil) end end) frame.anim:Play() end diff --git a/modules/GlobalCoolDown.lua b/modules/GlobalCoolDown.lua index 494f264..39b9ad9 100644 --- a/modules/GlobalCoolDown.lua +++ b/modules/GlobalCoolDown.lua @@ -27,8 +27,6 @@ function GlobalCoolDown.prototype:Enable(core) self:RegisterEvent("ACTIONBAR_UPDATE_COOLDOWN", "CooldownStateChanged") - self.scheduledEvent = self:ScheduleRepeatingTimer("UpdateGlobalCoolDown", 0.05) - self:Show(false) end @@ -77,9 +75,9 @@ function GlobalCoolDown.prototype:GetDefaultSettings() settings["enabled"] = false settings["side"] = IceCore.Side.Left settings["offset"] = 6 - settings["shouldAnimate"] = false + settings["shouldAnimate"] = true settings["hideAnimationSettings"] = true - settings["desiredLerpTime"] = nil + settings["desiredLerpTime"] = 1 settings["lowThreshold"] = 0 settings["barVisible"]["bg"] = false settings["usesDogTagStrings"] = false @@ -107,10 +105,17 @@ function GlobalCoolDown.prototype:CooldownStateChanged() self.startTime = start self.duration = dur - self.CurrScale = 1 + if self.CurrScale < 0.01 or self.CurrScale == 1 then + self:SetScale(1, true) + self.LastScale = 1 + self.DesiredScale = 0 + self.CurrLerpTime = 0 + self.moduleSettings.desiredLerpTime = dur or 1 + end self.frame:SetFrameStrata("TOOLTIP") self:Show(true) self.frame.bg:SetAlpha(0) + self.barFrame.bar:SetVertexColor(self:GetColor("GlobalCoolDown", 0.8)) else self.duration = nil self.startTime = nil @@ -129,7 +134,7 @@ function GlobalCoolDown.prototype:UpdateGlobalCoolDown() self:Show(false) else - self:UpdateBar(1 - (self.duration ~= 0 and remaining / self.duration or 0), "GlobalCoolDown", 0.8) +-- self:UpdateBar(1 - (self.duration ~= 0 and remaining / self.duration or 0), "GlobalCoolDown", 0.8) end else self:Show(false)