Fix panel alignment: center-panel overlap and Quest Log/Friends/Spellbook heights (#63)

* Only move the center panel when it overlaps the left panel

The panel aligner cached the left panel's rightmost child once and then
re-anchored the center panel to that edge on every change. Children that
were hidden later (such as Spellbook skill-line tabs) kept pushing the
center panel right, and panels that already cleared the left panel were
pulled back to the left.

Recalculate the rightmost visible child while both panels are shown and
only shift the center panel when its backdrop really overlaps.

* Align Quest Log, Friends and Spellbook panel heights

Most skinned panels draw their backdrop 430px tall, 10px below the frame
top (insets 10/-10 and -30/72). Three panels did not match:

- Quest Log: frame was 440px and anchored at y -104, so it stood 10px
  taller than a panel opened beside it. It is now 430px at y -114, with
  the list/detail panes and visible rows (22) reduced to fit.
- Friends: bottom inset was 74 instead of 72.
- Spellbook: top-left inset was 12/-12 instead of 10/-10.

The Quest Log is a doublewide UI panel. Opening another panel next to
it made UpdateUIPanelPositions re-anchor it to the default (0, -104),
causing a visible jump. Its UIPanelWindows entry now carries the same
x/y offsets as the OnShow anchor.

* Let the panel manager place UI panels

Remove the OnUpdate panel aligner. UpdateUIPanelPositions already lays
out left/center/right panels, and with the overlap-only rule the
aligner no longer changed the spacing in normal cases.

The Quest Log's UIPanelWindows offsets put it at 10, -114 on every
layout pass, so the QuestLog_OnShow re-anchor is redundant.

---------

Co-authored-by: Brues <5278969+brues-code@users.noreply.github.com>
This commit is contained in:
Thorsten42
2026-10-22 20:48:41 -05:00
committed by GitHub
co-authored by Brues
parent 341ba95561
commit 287a4ed46c
4 changed files with 14 additions and 49 deletions
+1 -36
View File
@@ -1,39 +1,4 @@
pfUI:RegisterModule("skin", function () pfUI:RegisterModule("skin", function ()
-- align UIParent panels
pfUI.panelalign = CreateFrame("Frame", "pfUIParentPanelAlign", UIParent)
pfUI.panelalign:SetScript("OnUpdate", function()
-- throttle to 5 updates per second instead of every frame
if (this.tick or 0.2) > GetTime() then return else this.tick = GetTime() + 0.2 end
local left = UIParent.left
local center = UIParent.center
local rbpos, ropos
-- detect outer frame backdrops
if left and not left.rightObj then
left.rightObj = left.backdrop or left
for _, frame in pairs({left:GetChildren()}) do
rbpos = frame.backdrop and frame.backdrop.GetRight and frame.backdrop:GetRight()
ropos = left.rightObj and left.rightObj.GetRight and left.rightObj:GetRight()
if rbpos and ropos and rbpos > ropos then
left.rightObj = frame.backdrop
end
end
end
-- reset anchors
if not left or not left:IsShown() or not center or not center:IsShown() then
UIParent.pfLeftAligned = nil
return
elseif center and center:IsShown() and left and left:IsShown() then
local width = left.rightObj:GetRight()
if width and width ~= UIParent.pfLeftAligned then
center:SetPoint("TOPLEFT", "UIParent", "TOPLEFT", width + 10, -104)
UIParent.pfLeftAligned = width
end
end
end)
-- durability frame -- durability frame
pfUI.durability = CreateFrame("Frame", "pfDurability", UIParent) pfUI.durability = CreateFrame("Frame", "pfDurability", UIParent)
if pfUI.minimap then if pfUI.minimap then
@@ -79,4 +44,4 @@ pfUI:RegisterModule("skin", function ()
else else
UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE") UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE")
end end
end) end)
+2 -2
View File
@@ -8,8 +8,8 @@ pfUI:RegisterSkin("Friends", function ()
CreateBackdropShadow(FriendsFrame) CreateBackdropShadow(FriendsFrame)
FriendsFrame.backdrop:SetPoint("TOPLEFT", 8, -10) FriendsFrame.backdrop:SetPoint("TOPLEFT", 8, -10)
FriendsFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 74) FriendsFrame.backdrop:SetPoint("BOTTOMRIGHT", -32, 72)
FriendsFrame:SetHitRectInsets(8,32,10,74) FriendsFrame:SetHitRectInsets(8,32,10,72)
EnableMovable("FriendsFrame") EnableMovable("FriendsFrame")
SkinCloseButton(FriendsFrameCloseButton, FriendsFrame.backdrop, -6, -6) SkinCloseButton(FriendsFrameCloseButton, FriendsFrame.backdrop, -6, -6)
+9 -9
View File
@@ -2,19 +2,19 @@ pfUI:RegisterSkin("Quest Log", function ()
local rawborder, border = GetBorderSize() local rawborder, border = GetBorderSize()
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel() local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
_G.QUESTS_DISPLAYED = 23 _G.QUESTS_DISPLAYED = 22
_G.MAX_WATCHABLE_QUESTS = 20 -- TODO _G.MAX_WATCHABLE_QUESTS = 20 -- TODO
do -- quest log frame do -- quest log frame
QuestLogQuestCount:ClearAllPoints() QuestLogQuestCount:ClearAllPoints()
QuestLogQuestCount:SetPoint("TOPRIGHT", -10, -30) QuestLogQuestCount:SetPoint("TOPRIGHT", -10, -30)
hooksecurefunc("QuestLog_OnShow", function() -- let the panel manager anchor this doublewide panel at 10, -114
QuestLogFrame:ClearAllPoints() UIPanelWindows["QuestLogFrame"].xoffset = 10
QuestLogFrame:SetPoint("TOPLEFT", 10, -104) UIPanelWindows["QuestLogFrame"].yoffset = -10
end)
QuestLogFrame:SetSize(676, 440) -- match the 430px height and top edge of the other skinned panels
QuestLogFrame:SetSize(676, 430)
QuestLogFrame:DisableDrawLayer("BACKGROUND") QuestLogFrame:DisableDrawLayer("BACKGROUND")
StripTextures(QuestLogFrame, true) StripTextures(QuestLogFrame, true)
@@ -144,7 +144,7 @@ pfUI:RegisterSkin("Quest Log", function ()
end end
QuestLogListScrollFrame:SetPoint("TOPLEFT", 10, -54) QuestLogListScrollFrame:SetPoint("TOPLEFT", 10, -54)
QuestLogListScrollFrame:SetHeight(350) QuestLogListScrollFrame:SetHeight(340)
hooksecurefunc("QuestLog_Update", function() hooksecurefunc("QuestLog_Update", function()
local numEntries = GetNumQuestLogEntries() local numEntries = GetNumQuestLogEntries()
@@ -181,8 +181,8 @@ pfUI:RegisterSkin("Quest Log", function ()
QuestLogDetailScrollFrame:ClearAllPoints() QuestLogDetailScrollFrame:ClearAllPoints()
QuestLogDetailScrollFrame:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPRIGHT", 35, 0) QuestLogDetailScrollFrame:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPRIGHT", 35, 0)
QuestLogDetailScrollFrame:SetHeight(376) QuestLogDetailScrollFrame:SetHeight(366)
QuestLogDetailScrollChildFrame:SetHeight(376) QuestLogDetailScrollChildFrame:SetHeight(366)
local bg = QuestLogDetailScrollFrame:CreateTexture(nil, "BACKGROUND") local bg = QuestLogDetailScrollFrame:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints() bg:SetAllPoints()
+2 -2
View File
@@ -6,9 +6,9 @@ pfUI:RegisterSkin("Spellbook", function ()
CreateBackdrop(SpellBookFrame, nil, nil, .75) CreateBackdrop(SpellBookFrame, nil, nil, .75)
CreateBackdropShadow(SpellBookFrame) CreateBackdropShadow(SpellBookFrame)
SpellBookFrame.backdrop:SetPoint("TOPLEFT", 12, -12) SpellBookFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
SpellBookFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72) SpellBookFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
SpellBookFrame:SetHitRectInsets(12,30,12,72) SpellBookFrame:SetHitRectInsets(10,30,10,72)
EnableMovable(SpellBookFrame) EnableMovable(SpellBookFrame)
SpellBookTitleText:ClearAllPoints() SpellBookTitleText:ClearAllPoints()