Skip to content

Commit

Permalink
use blizzards own spellbar anchor for TBC instead of custom (fixes #51)
Browse files Browse the repository at this point in the history
  • Loading branch information
wardz committed Aug 20, 2021
1 parent f596e1e commit 2b4b276
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ClassicCastbars/core/Frames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ local nonLSMBorders = {
["Interface\\CastingBar\\UI-CastingBar-Border"] = true,
}

local isClassic = _G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC

local function GetStatusBarBackgroundTexture(statusbar)
if statusbar.Background then return statusbar.Background end

Expand Down Expand Up @@ -48,6 +50,27 @@ function addon:GetCastbarFrame(unitID)
end

function addon:SetTargetCastbarPosition(castbar, parentFrame)
if not isClassic and parentFrame:GetName() == "TargetFrame" then
if ( parentFrame.haveToT ) then
if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -21 )
else
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
end
elseif ( parentFrame.haveElite ) then
if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -5 )
else
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
end
else
if ( (not parentFrame.buffsOnTop) and parentFrame.auraRows > 0 ) then
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
else
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, 7 )
end
end
else -- for classic era or unknown parent frame
local auraRows = parentFrame.auraRows or 0

if parentFrame.buffsOnTop or auraRows <= 1 then
Expand All @@ -57,6 +80,7 @@ function addon:SetTargetCastbarPosition(castbar, parentFrame)
castbar:SetPoint("CENTER", parentFrame, -18, max(min(-75, -43 * auraRows), -150))
else
castbar:SetPoint("CENTER", parentFrame, -18, max(min(-75, -39 * auraRows), -150))
end
end
end
end
Expand Down

0 comments on commit 2b4b276

Please sign in to comment.