View Single Post
05-03-22, 05:18 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,333
Originally Posted by Xrystal View Post
LayoutBars essentially repositions the bars in line with their parents position which by default is the MainMenuBar. So outside of re-parenting and dealing with any issues arising outside of that you might be able to hook into StatusTrackingManagerMixin:LayoutBar(bar, barWidth, isTopBar, isDouble) and reset the layout of each bar as you wish it to be.
Not completely true. The repositioning is further down the line at MainMenuBarMixin:SetPositionForStatusBars(). It queries StatusTrackingBarManager:GetNumberVisibleBars() and sets .yOffset accordingly. UIParent_ManageFramePositions() (frontend for FramePositionDelegate:UIParentManageFramePositions()) reads .yOffset and is the one responsible for moving the frame. This process is susceptible to taint, so manipulating .yOffset will throw errors in combat.

It is possible to stop this by nuking MainMenuBarMixin:SetPositionForStatusBars(). As MainMenuBar is already instantiated, changing MainMenuBarMixin won't do anything. You'll have to modify MainMenuBar:SetPositionForStatusBars() instead.
Code:
 MainMenuBar.SetPositionForStatusBars=function() end;


Note UIParent_ManageFramePositions() will still try to move MainMenuBar whenever any other part of the UI calls it. Since MainMenuBarMixin:SetPositionForStatusBars() would no longer be changing .yOffset, it'll always snap the the same spot. If you want to set your own anchor, the code block at UIParent.lua:3340 allows bypassing this by setting MainMenuBar as user-placed.
Lua Code:
  1. MainMenuBar:SetMovable(true);-- Required for :SetUserPlaced()
  2. MainMenuBar:SetUserPlaced(true);--  Set user-placed flag

While :SetMovable() does allow dragging frames and sizing them, this doesn't happen unless :StartMoving() or :StartSizing() is called. This doesn't happen for MainMenuBar.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-03-22 at 05:21 PM.
  Reply With Quote