Skip to content

Commit

Permalink
fix castbar not immediately updating position when target of target f…
Browse files Browse the repository at this point in the history
…rame is updated
  • Loading branch information
wardz committed Nov 9, 2023
1 parent 8539edb commit 62a261e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ClassicCastbars/ClassicCastbars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,13 @@ end
function addon:ToggleUnitEvents(shouldReset)
if self.db.target.enabled then
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterUnitEvent("UNIT_TARGET", "target")
if self.db.target.autoPosition then
self:RegisterUnitEvent("UNIT_AURA", "target")
end
else
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
self:UnregisterEvent("UNIT_TARGET")
self:UnregisterEvent("UNIT_AURA")
end

Expand Down Expand Up @@ -439,6 +441,17 @@ function addon:ADDON_LOADED(addonName)
end
end

function addon:UNIT_TARGET(unitID) -- detect target of target
if self.db[unitID] and self.db[unitID].autoPosition then
if activeFrames[unitID] then
local parentFrame = self.AnchorManager:GetAnchor(unitID)
if parentFrame then
self:SetTargetCastbarPosition(activeFrames[unitID], parentFrame)
end
end
end
end

local auraRows = 0
function addon:UNIT_AURA()
if not self.db.target.autoPosition then return end
Expand Down
12 changes: 12 additions & 0 deletions ClassicCastbars/ClassicCastbars_NonClassic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ function addon:BindCurrentCastData(castbar, unitID, isChanneled)
end
end

function addon:UNIT_TARGET(unitID) -- detect target of target
if self.db[unitID] and self.db[unitID].autoPosition then
if activeFrames[unitID] then
local parentFrame = self.AnchorManager:GetAnchor(unitID)
if parentFrame then
self:SetTargetCastbarPosition(activeFrames[unitID], parentFrame)
end
end
end
end

-- Check UNIT_AURA aswell for cast immunites since CLEU range in classic is very short
function addon:UNIT_AURA(unitID)
if self.db[unitID] and self.db[unitID].autoPosition then
Expand Down Expand Up @@ -454,6 +465,7 @@ function addon:ToggleUnitEvents(shouldReset)
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterEvent("PLAYER_FOCUS_CHANGED")
self:RegisterEvent("UNIT_AURA")
self:RegisterUnitEvent("UNIT_TARGET", "target", "focus")

if self.db.party.enabled then
self:RegisterEvent("GROUP_ROSTER_UPDATE")
Expand Down

0 comments on commit 62a261e

Please sign in to comment.