完成焦点等开发

This commit is contained in:
rucky
2026-03-31 18:03:23 +08:00
parent c7dd0f4848
commit 6e18269bfd
34 changed files with 6803 additions and 542 deletions

View File

@@ -143,6 +143,7 @@ local function ForwardScrollWheel(frame)
local p = this:GetParent()
while p do
if p:GetObjectType() == "ScrollFrame" then
if p.UpdateScrollChildRect then p:UpdateScrollChildRect() end
local cur = p:GetVerticalScroll()
local maxVal = p:GetVerticalScrollRange()
if arg1 > 0 then
@@ -208,8 +209,16 @@ local function CreateScrollArea(parent, name)
content:SetHeight(1)
scroll:SetScrollChild(content)
-- Hook content:SetHeight to auto-refresh scroll range
local origSetHeight = content.SetHeight
content.SetHeight = function(self, h)
origSetHeight(self, h)
if scroll.UpdateScrollChildRect then scroll:UpdateScrollChildRect() end
end
scroll:EnableMouseWheel(true)
scroll:SetScript("OnMouseWheel", function()
if this.UpdateScrollChildRect then this:UpdateScrollChildRect() end
local cur = this:GetVerticalScroll()
local maxVal = this:GetVerticalScrollRange()
if arg1 > 0 then
@@ -705,6 +714,9 @@ local function ShowPage(name)
if pages[name] then
pages[name]:Show()
if pages[name].scroll then
if pages[name].scroll.UpdateScrollChildRect then
pages[name].scroll:UpdateScrollChildRect()
end
pages[name].scroll:SetVerticalScroll(0)
end
end
@@ -1555,6 +1567,19 @@ function QUI:Initialize()
end
end
end
-- Deferred scroll refresh: re-layout after 1 frame so FontString heights are valid
if MainFrame._deferredPage then
MainFrame._deferredTick = (MainFrame._deferredTick or 0) + 1
if MainFrame._deferredTick >= 2 then
local pg = pages[MainFrame._deferredPage]
if pg and pg.Update then pg.Update() end
if pg and pg.scroll and pg.scroll.UpdateScrollChildRect then
pg.scroll:UpdateScrollChildRect()
end
MainFrame._deferredPage = nil
MainFrame._deferredTick = nil
end
end
end)
MainFrame:Hide()
@@ -1578,6 +1603,7 @@ function QUI:Initialize()
pages.gossip.Update()
UpdateBottomButtons()
MainFrame:Show()
MainFrame._deferredPage = "gossip"; MainFrame._deferredTick = 0
elseif event == "GOSSIP_CLOSED" then
if currentPage == "gossip" then
@@ -1593,6 +1619,7 @@ function QUI:Initialize()
pages.greeting.Update()
UpdateBottomButtons()
MainFrame:Show()
MainFrame._deferredPage = "greeting"; MainFrame._deferredTick = 0
elseif event == "QUEST_DETAIL" then
pendingClose = false
@@ -1601,6 +1628,7 @@ function QUI:Initialize()
pages.detail.Update()
UpdateBottomButtons()
MainFrame:Show()
MainFrame._deferredPage = "detail"; MainFrame._deferredTick = 0
elseif event == "QUEST_PROGRESS" then
pendingClose = false
@@ -1609,6 +1637,7 @@ function QUI:Initialize()
pages.progress.Update()
UpdateBottomButtons()
MainFrame:Show()
MainFrame._deferredPage = "progress"; MainFrame._deferredTick = 0
elseif event == "QUEST_COMPLETE" then
pendingClose = false
@@ -1618,6 +1647,7 @@ function QUI:Initialize()
pages.complete.Update()
UpdateBottomButtons()
MainFrame:Show()
MainFrame._deferredPage = "complete"; MainFrame._deferredTick = 0
elseif event == "QUEST_FINISHED" then
if previousPage then