Hi guyz.
I want to move the FocusFrame's castbar (FocusFrameSpellBar) in a way that both frames (FocusFrame and FocusFrameSpellBar) have its right edges on the same line.
I can only change the X-offset of the anchor, because Blizzard's native code is constantly changing the anchor with different offsets and relative frames, to adjust the position of the castbar to the amount of buffs/debuffs of the FocusFrame.
I'm using GetRight() for the task:
Lua Code:
local function FocusCastbarReposition()
local FocusRight = FocusFrame:GetRight() * FocusFrame:GetEffectiveScale()
local CastRight = FocusFrameSpellBar:GetRight() * FocusFrameSpellBar:GetEffectiveScale()
local Gap = FocusRight - CastRight
local P = { FocusFrameSpellBar:GetPoint() }
FocusFrameSpellBar:ClearAllPoints()
FocusFrameSpellBar:SetPoint(P[1], P[2], P[3], P[4] + Gap, P[5])
Addon:SetScript("OnUpdate", nil)
end
-- Changing the X-offset of FocusFrame's castbar in the
-- next frame (when the anchor values will be updated)
hooksecurefunc(FocusFrameSpellBar, "SetPoint", function()
Addon:SetScript("OnUpdate", FocusCastbarReposition)
end)
But it doesn't works, the final position is not correct.
I have used the same technique (substraction using GetRight() values) with textures with success, but looks like when it's 2 frames with different scales, it's not that easy. :-/
Does anybody knows the solution?