From 3a68ef1a61b07572563c26b1d7fbb8bc184dbbdb Mon Sep 17 00:00:00 2001 From: Parnic Date: Mon, 11 Oct 2010 05:50:10 +0000 Subject: [PATCH] - fixed rotation of inverted bars to draw the bar correctly - better method of turning the player and pet casting frames back when enabling the "show default cast bar" option in the player cast bar --- IceBarElement.lua | 16 ++++++++++++++-- modules/CastBar.lua | 16 ++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index 570ec0f..46bd4bd 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -805,7 +805,7 @@ function IceBarElement.prototype:CreateFrame() self.frame:SetScript("OnUpdate", function() self:MyOnUpdate() end) end - if self.moduleSettings.rotateBar and self.frame.anim == nil then + if self.moduleSettings.rotateBar then self:RotateHorizontal() end end @@ -1229,6 +1229,10 @@ function IceBarElement.prototype:ResetRotation() end function IceBarElement.prototype:RotateFrame(frame) + if not frame then + return + end + if frame.anim == nil then local grp = frame:CreateAnimationGroup() local rot = grp:CreateAnimation("Rotation") @@ -1237,10 +1241,18 @@ function IceBarElement.prototype:RotateFrame(frame) rot:SetOrder(1) rot:SetDuration(0.001) rot:SetDegrees(-90) - rot:SetOrigin("BOTTOMLEFT", 0, 0) grp.rot = rot frame.anim = grp end + + local anchorPoint + if self.moduleSettings.inverse then + anchorPoint = "TOPLEFT" + else + anchorPoint = "BOTTOMLEFT" + end + + frame.anim.rot:SetOrigin(anchorPoint, 0, 0) 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/CastBar.lua b/modules/CastBar.lua index 04d188a..8191f88 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -330,20 +330,8 @@ end function CastBar.prototype:ToggleBlizzCast(on) if on then -- restore blizz cast bar - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SENT"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_START"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_STOP"); - - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_FAILED"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_DELAYED"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED"); - - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE"); - CastingBarFrame:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP"); - - PetCastingBarFrame:RegisterEvent("UNIT_PET"); + CastingBarFrame:GetScript("OnLoad")(CastingBarFrame) + PetCastingBarFrame:GetScript("OnLoad")(PetCastingBarFrame) else -- remove blizz cast bar CastingBarFrame:UnregisterAllEvents()