Files
pfUI/skins/blizzard/questlog.lua
T
Thorsten42andBrues 287a4ed46c 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>
2026-10-22 20:48:41 -05:00

229 lines
8.3 KiB
Lua

pfUI:RegisterSkin("Quest Log", function ()
local rawborder, border = GetBorderSize()
local bpad = rawborder > 1 and border - GetPerfectPixel() or GetPerfectPixel()
_G.QUESTS_DISPLAYED = 22
_G.MAX_WATCHABLE_QUESTS = 20 -- TODO
do -- quest log frame
QuestLogQuestCount:ClearAllPoints()
QuestLogQuestCount:SetPoint("TOPRIGHT", -10, -30)
-- let the panel manager anchor this doublewide panel at 10, -114
UIPanelWindows["QuestLogFrame"].xoffset = 10
UIPanelWindows["QuestLogFrame"].yoffset = -10
-- match the 430px height and top edge of the other skinned panels
QuestLogFrame:SetSize(676, 430)
QuestLogFrame:DisableDrawLayer("BACKGROUND")
StripTextures(QuestLogFrame, true)
CreateBackdrop(QuestLogFrame, nil, nil, .75)
CreateBackdropShadow(QuestLogFrame)
EnableMovable(QuestLogFrame)
QuestLogTitleText:ClearAllPoints()
QuestLogTitleText:SetPoint("TOP", 0, -10)
SkinCloseButton(QuestLogFrameCloseButton, QuestLogFrame, -6, -6)
QuestLogNoQuestsText:ClearAllPoints()
QuestLogNoQuestsText:SetPoint("TOP", QuestLogFrame, 0, -100)
local QuestLogFrameLevelsCheckButton = CreateFrame("CheckButton", "QuestLogFrameLevelsCheckButton", QuestLogFrame, "UICheckButtonTemplate")
QuestLogFrameLevelsCheckButton:SetChecked(C.questlog.showQuestLevels == "1" and true or nil)
QuestLogFrameLevelsCheckButton:SetPoint("LEFT", QuestLogCollapseAllButton, "RIGHT", 0, 1)
QuestLogFrameLevelsCheckButton:SetScript("OnClick", function()
C.questlog.showQuestLevels = C.questlog.showQuestLevels == "1" and "0" or "1"
-- also update pfQuest's config
if pfQuest_config and pfQuestConfig and pfQuestConfig.UpdateConfigEntries then
pfQuest_config["questloglevel"] = C.questlog.showQuestLevels
pfQuestConfig:UpdateConfigEntries()
end
QuestLog_Update()
end)
SkinCheckbox(QuestLogFrameLevelsCheckButton, 23)
QuestLogFrameLevelsCheckButtonText:SetText(T["Quest Levels"])
CreateBackdrop(QuestLogTrack)
QuestLogTrack:SetSize(8, 8)
QuestLogTrack:ClearAllPoints()
QuestLogTrack:SetPoint("RIGHT", QuestLogQuestCount, "LEFT", -5, 0)
StripTextures(QuestLogTrack)
QuestLogTrackTracking:SetTexture(.8,.8,.8,1)
QuestLogTrackTitle:Hide()
SkinButton(QuestLogFrameAbandonButton)
QuestLogFrameAbandonButton:ClearAllPoints()
QuestLogFrameAbandonButton:SetPoint("BOTTOMLEFT", QuestLogFrame, "BOTTOMLEFT", 5, 5)
QuestLogFrameAbandonButton:SetWidth(98)
SkinButton(QuestFramePushQuestButton)
QuestFramePushQuestButton:ClearAllPoints()
QuestFramePushQuestButton:SetPoint("LEFT", QuestLogFrameAbandonButton, "RIGHT", 5, 0)
QuestFramePushQuestButton:SetWidth(98)
SkinButton(QuestFrameExitButton)
QuestFrameExitButton:ClearAllPoints()
QuestFrameExitButton:SetPoint("LEFT", QuestFramePushQuestButton, "RIGHT", 5, 0)
QuestFrameExitButton:SetWidth(99)
local QuestLogFrameExpandButton = CreateFrame("Button", "QuestLogFrameExpandButton", QuestLogFrame, "UIPanelButtonTemplate")
SkinArrowButton(QuestLogFrameExpandButton, "LEFT", 21)
SetAllPointsOffset(QuestLogFrameExpandButton.icon, QuestLogFrameExpandButton, 6)
QuestLogFrameExpandButton:SetPoint("LEFT", QuestFrameExitButton, "RIGHT", 5, 0)
QuestLogFrameExpandButton:SetScript("OnClick", function()
if QuestLogDetailScrollFrame:IsShown() then
QuestLogDetailScrollFrame:Hide()
QuestLogDetailScrollFrame.hidden = true
else
QuestLogDetailScrollFrame:Show()
QuestLogDetailScrollFrame.hidden = nil
end
end)
QuestLogDetailScrollFrame:HookScript("OnHide", function()
SkinArrowButton(QuestLogFrameExpandButton, "RIGHT", 21)
QuestLogDetailScrollFrame:Hide()
QuestLogFrame:SetWidth(340)
end)
QuestLogDetailScrollFrame:HookScript("OnShow", function()
SkinArrowButton(QuestLogFrameExpandButton, "LEFT", 21)
QuestLogDetailScrollFrame:Show()
QuestLogFrame:SetWidth(676)
QuestLog_UpdateQuestDetails()
end)
StripTextures(EmptyQuestLogFrame)
EmptyQuestLogFrame:SetScript("OnShow", function()
-- trigger hide events
if QuestLogDetailScrollFrame:IsShown() then
QuestLogDetailScrollFrame:Hide()
else
QuestLogDetailScrollFrame:GetScript("OnHide")()
end
QuestLogFrameExpandButton:Disable()
end)
EmptyQuestLogFrame:SetScript("OnHide", function()
QuestLogFrameExpandButton:Enable()
end)
end
do -- left pane
StripTextures(QuestLogListScrollFrame)
SkinScrollbar(QuestLogListScrollFrameScrollBar)
StripTextures(QuestLogExpandButtonFrame) -- ?
StripTextures(QuestLogCollapseAllButton)
SkinCollapseButton(QuestLogCollapseAllButton, true)
-- collapse buttons
QuestLogCollapseAllButton:ClearAllPoints()
QuestLogCollapseAllButton:SetPoint("BOTTOMLEFT", QuestLogTitle1, "TOPLEFT", -6, 4)
for i = 1, QUESTS_DISPLAYED do SkinCollapseButton(_G["QuestLogTitle"..i]) end
-- quest list backdrop
local backdrop = CreateFrame("Frame", nil, QuestLogFrame)
CreateBackdrop(backdrop, nil, nil, .75)
backdrop.backdrop:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPLEFT", -5, 5)
backdrop.backdrop:SetPoint("BOTTOMRIGHT", QuestLogListScrollFrame, "BOTTOMRIGHT", 26, -5)
QuestLogTitle1:ClearAllPoints()
QuestLogTitle1:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPLEFT", 0, 0)
-- add additional scroll entries
for i = 7, QUESTS_DISPLAYED do
local b = _G["QuestLogTitle"..i] or CreateFrame("Button", "QuestLogTitle"..i, QuestLogFrame, "QuestLogTitleButtonTemplate")
b:SetID(i)
b:SetPoint("TOPLEFT", _G["QuestLogTitle"..(i-1)], "BOTTOMLEFT", 0, 1)
SkinCollapseButton(_G["QuestLogTitle"..i])
end
QuestLogListScrollFrame:SetPoint("TOPLEFT", 10, -54)
QuestLogListScrollFrame:SetHeight(340)
hooksecurefunc("QuestLog_Update", function()
local numEntries = GetNumQuestLogEntries()
local questIndex, text, level, questTag, isHeader
if QuestLogDetailScrollFrame.hidden then
QuestLogDetailScrollFrame:Hide()
end
for i=1, QUESTS_DISPLAYED do
-- update tracked quest marks
_G["QuestLogTitle"..i.."Check"]:ClearAllPoints()
_G["QuestLogTitle"..i.."Check"]:SetPoint("RIGHT", _G["QuestLogTitle"..i], "LEFT", 24, 0)
-- update quest level
if C.questlog.showQuestLevels == "1" then
questIndex = i + FauxScrollFrame_GetOffset(QuestLogListScrollFrame)
if questIndex <= numEntries then
text, level, questTag, isHeader = GetQuestLogTitle(questIndex)
if not isHeader then
_G["QuestLogTitle"..i]:SetText(" ".."["..(questTag and level.."+" or level).."] "..text)
end
end
end
end
end)
end
do -- right pane
StripTextures(QuestLogDetailScrollFrame)
SkinScrollbar(QuestLogDetailScrollFrameScrollBar)
QuestLogDetailScrollFrame:ClearAllPoints()
QuestLogDetailScrollFrame:SetPoint("TOPLEFT", QuestLogListScrollFrame, "TOPRIGHT", 35, 0)
QuestLogDetailScrollFrame:SetHeight(366)
QuestLogDetailScrollChildFrame:SetHeight(366)
local bg = QuestLogDetailScrollFrame:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints()
bg:SetTexCoord(.1,1,0,1)
bg:SetTexture("Interface\\Stationery\\StationeryTest1")
-- quest log backdrop
CreateBackdrop(QuestLogDetailScrollFrame, nil, nil, .75)
QuestLogDetailScrollFrame.backdrop:SetPoint("TOPLEFT", -5, 5)
QuestLogDetailScrollFrame.backdrop:SetPoint("BOTTOMRIGHT", 26, -5)
-- skin item buttons
for i = 1, MAX_NUM_ITEMS do
local name = "QuestLogItem" .. i
local item = _G[name]
local icon = _G[name.."IconTexture"]
local count = _G[name.."Count"]
local title = _G[name.."Name"]
local xsize = item:GetWidth() -12
local ysize = item:GetHeight() -12
item:SetWidth(xsize)
StripTextures(item)
CreateBackdrop(item, nil, nil, .75)
SetAllPointsOffset(item.backdrop, item, 4)
SetHighlight(item)
icon:SetSize(ysize, ysize)
icon:ClearAllPoints()
icon:SetPoint("LEFT", 6, 0)
icon:SetTexCoord(.08, .92, .08, .92)
icon:SetParent(item.backdrop)
icon:SetDrawLayer("OVERLAY")
count:SetParent(item.backdrop)
count:SetDrawLayer("OVERLAY")
title:SetParent(item.backdrop)
title:SetDrawLayer("OVERLAY")
end
end
end)