Commit 17700258 authored by Blazeflack's avatar Blazeflack
Browse files

Fixed code to account for the new backdrop spacing option

parent 811a0784
......@@ -26,6 +26,7 @@ end
function CBS:PlayerCastbarSetWidth(i)
local buttonSpacing = E:Scale(E.db.actionbar['bar'..i].buttonspacing);
local backdropSpacing = E:Scale(E.db.actionbar['bar'..i].backdropSpacing);
local buttonsPerRow = E.db.actionbar['bar'..i].buttonsPerRow;
local numButtons = E.db.actionbar['bar'..i].buttons;
local buttonSize = E:Scale(E.db.actionbar['bar'..i].buttonsize);
......@@ -36,10 +37,10 @@ function CBS:PlayerCastbarSetWidth(i)
end
--Calculate the additional width of the backdrop
local backdropWidth = E.db.actionbar['bar'..i].backdrop and (buttonSpacing + (buttonSpacing * widthMult)) or 0
local backdropWidth = E.db.actionbar['bar'..i].backdrop and (backdropSpacing*2 + E.Border*2 - E.Spacing*4) or 0
--Calculate total width needed for the castbar
local castbarwidth = (backdropWidth + (buttonSize * (buttonsPerRow * widthMult)) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (E.Spacing * 2))
local castbarwidth = (backdropWidth + (buttonSize * buttonsPerRow * widthMult) + ((buttonSpacing * (buttonsPerRow - 1)) * widthMult) + (buttonSpacing * (widthMult-1)) + E.Spacing*2)
if E.db.CBS.player.enable == true then
E.db.unitframe.units.player.castbar.width = castbarwidth
......@@ -52,17 +53,17 @@ function CBS:PlayerCastbarSetWidth(i)
end
function CBS:PositionPlayerCastbar(i)
local buttonSpacing = E:Scale(E.db.actionbar['bar'..i].buttonspacing);
local yOffset = ((E.Spacing * 2) + E.db.CBS.player.yOffset)
local backdropSpacing = E:Scale(E.db.actionbar['bar'..i].backdropSpacing);
local yOffset = E.db.CBS.player.yOffset
local bar = _G["ElvUI_Bar"..i]
local castbarMover = _G["ElvUF_PlayerCastbarMover"]
if E.db.CBS.player.enable == true then
ElvUF_PlayerCastbarMover:ClearAllPoints()
if E.db.actionbar['bar'..i].backdrop then
castbarMover:Point('BOTTOMRIGHT', bar, 'TOPRIGHT', E.Spacing, yOffset)
castbarMover:Point('BOTTOMRIGHT', bar, 'TOPRIGHT', 0, yOffset)
else
castbarMover:Point('BOTTOMRIGHT', bar, 'TOPRIGHT', -buttonSpacing + E.Spacing, -buttonSpacing +yOffset)
castbarMover:Point('BOTTOMRIGHT', bar, 'TOPRIGHT', -backdropSpacing + E.Spacing*2, -backdropSpacing +yOffset +E.Spacing*2)
end
else
E:ResetMovers(castbarMover.textString)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment