Quantcast
WoWInterface - View Single Post - GetRight() positioning problem
View Single Post
12-20-13, 12:09 AM   #2
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 353
The player, target, and focus frames (probably arena and boss frames too) are actually larger than what is visible. The invisible portion is on the portrait side which would be the reason for GetRight seeming to return an incorrect value for the focus frame. To test in game just do /framestack and see when it says you are over the focus frame when mousing over the area around the portrait and just off to the side of it.

Try using the portrait's right instead:
Code:
local function FocusCastbarReposition()
  local focusRight = FocusFramePortrait:GetRight() * FocusFrame:GetEffectiveScale()
  local castRight = FocusFrameSpellBar:GetRight() * FocusFrameSpellBar:GetEffectiveScale()
  local point, relFrame, relPoint, xOffset, yOffset = FocusFrameSpellBar:GetPoint()
  FocusFrameSpellBar:ClearAllPoints()
  FocusFrameSpellBar:SetPoint(point, relFrame, relPoint, xOffset + focusRight - castRight, yOffset)
  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)
I also think you would want to divide the scale and not multiply but it's late and I'm tired so maybe not.

Last edited by Vrul : 12-20-13 at 12:26 AM.
  Reply With Quote