Originally Posted by Xrystal
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:
MainMenuBar:SetMovable(true);-- Required for :SetUserPlaced()
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.