Skip to content

Commit 2b4b276

Browse files
committed
use blizzards own spellbar anchor for TBC instead of custom (fixes #51)
1 parent f596e1e commit 2b4b276

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ClassicCastbars/core/Frames.lua

+24
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ local nonLSMBorders = {
1616
["Interface\\CastingBar\\UI-CastingBar-Border"] = true,
1717
}
1818

19+
local isClassic = _G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC
20+
1921
local function GetStatusBarBackgroundTexture(statusbar)
2022
if statusbar.Background then return statusbar.Background end
2123

@@ -48,6 +50,27 @@ function addon:GetCastbarFrame(unitID)
4850
end
4951

5052
function addon:SetTargetCastbarPosition(castbar, parentFrame)
53+
if not isClassic and parentFrame:GetName() == "TargetFrame" then
54+
if ( parentFrame.haveToT ) then
55+
if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
56+
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -21 )
57+
else
58+
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
59+
end
60+
elseif ( parentFrame.haveElite ) then
61+
if ( parentFrame.buffsOnTop or parentFrame.auraRows <= 1 ) then
62+
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, -5 )
63+
else
64+
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
65+
end
66+
else
67+
if ( (not parentFrame.buffsOnTop) and parentFrame.auraRows > 0 ) then
68+
castbar:SetPoint("TOPLEFT", parentFrame.spellbarAnchor, "BOTTOMLEFT", 20, -15)
69+
else
70+
castbar:SetPoint("TOPLEFT", parentFrame, "BOTTOMLEFT", 25, 7 )
71+
end
72+
end
73+
else -- for classic era or unknown parent frame
5174
local auraRows = parentFrame.auraRows or 0
5275

5376
if parentFrame.buffsOnTop or auraRows <= 1 then
@@ -57,6 +80,7 @@ function addon:SetTargetCastbarPosition(castbar, parentFrame)
5780
castbar:SetPoint("CENTER", parentFrame, -18, max(min(-75, -43 * auraRows), -150))
5881
else
5982
castbar:SetPoint("CENTER", parentFrame, -18, max(min(-75, -39 * auraRows), -150))
83+
end
6084
end
6185
end
6286
end

0 commit comments

Comments
 (0)