- 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
This commit is contained in:
Parnic
2010-09-13 13:54:38 +00:00
parent f12ee4110d
commit 73cc17927e
2 changed files with 12 additions and 7 deletions

View File

@ -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

View File

@ -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)