Add files via upload
This commit is contained in:
@@ -2498,8 +2498,14 @@ end
|
|||||||
-- * the addon just finished loading (initial pass over existing chat).
|
-- * the addon just finished loading (initial pass over existing chat).
|
||||||
--
|
--
|
||||||
-- Scans are rate-limited to at most one every RQL_SCAN_MIN_INTERVAL.
|
-- Scans are rate-limited to at most one every RQL_SCAN_MIN_INTERVAL.
|
||||||
local RQL_SCAN_MIN_INTERVAL = 0.25 -- hard cap: no more than 4 scans/sec
|
-- Near-instant update: [+] icons must track new chat lines the same frame
|
||||||
local RQL_SCAN_DELAY = 0.05 -- delay after event so regions are laid out
|
-- they render. A 0.25s throttle was visibly slow when messages scrolled up
|
||||||
|
-- and the old [+] drifted with them. We now scan on the very next frame.
|
||||||
|
-- Tiny throttle: enough to coalesce bursts of chat events (raids, spammy
|
||||||
|
-- channels) into a single rescan per frame-ish window, but small enough
|
||||||
|
-- that the [+] still tracks new lines effectively instantly to the eye.
|
||||||
|
local RQL_SCAN_MIN_INTERVAL = 0.03
|
||||||
|
local RQL_SCAN_DELAY = 0.01
|
||||||
local RQL_SCAN_PENDING_AT = nil
|
local RQL_SCAN_PENDING_AT = nil
|
||||||
local RQL_SCAN_LAST_AT = 0
|
local RQL_SCAN_LAST_AT = 0
|
||||||
|
|
||||||
@@ -2553,6 +2559,19 @@ RQL_ChatWatch:SetScript("OnEvent", function()
|
|||||||
RQL_SchedulePlusScan()
|
RQL_SchedulePlusScan()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Immediately hide every [+] button in the pool. Used on tab-switch so a
|
||||||
|
-- stale icon from the previous tab disappears the instant the user clicks
|
||||||
|
-- a new tab, without waiting for the next scan tick.
|
||||||
|
local function RQL_HideAllPlusButtons()
|
||||||
|
local i = 1
|
||||||
|
while RQL_PLUS_POOL[i] do
|
||||||
|
RQL_PLUS_POOL[i]:Hide()
|
||||||
|
RQL_PLUS_POOL[i].rqlEntry = nil
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
RQL_PoolIndex = 0
|
||||||
|
end
|
||||||
|
|
||||||
local function RQL_HookChatLinks()
|
local function RQL_HookChatLinks()
|
||||||
-- Chat scrolling / paging moves existing linked lines but doesn't fire
|
-- Chat scrolling / paging moves existing linked lines but doesn't fire
|
||||||
-- an event. Wrap the standard scroll helpers so [+] follows the text.
|
-- an event. Wrap the standard scroll helpers so [+] follows the text.
|
||||||
@@ -2576,6 +2595,40 @@ local function RQL_HookChatLinks()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Hook chat tab clicks so switching tabs instantly clears any stale [+]
|
||||||
|
-- from the previously-visible tab and re-scans the newly-visible one.
|
||||||
|
-- Also hook OnShow/OnHide on the frames themselves as a safety net for
|
||||||
|
-- undock/dock and other visibility changes.
|
||||||
|
for i = 1, maxFrames do
|
||||||
|
local tab = getglobal("ChatFrame" .. i .. "Tab")
|
||||||
|
if tab and not tab._rql_hooked_click then
|
||||||
|
local origClick = tab:GetScript("OnClick")
|
||||||
|
tab._rql_hooked_click = true
|
||||||
|
tab:SetScript("OnClick", function()
|
||||||
|
if origClick then origClick() end
|
||||||
|
RQL_HideAllPlusButtons()
|
||||||
|
RQL_SchedulePlusScan(0)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
local f = getglobal("ChatFrame" .. i)
|
||||||
|
if f and not f._rql_hooked_vis then
|
||||||
|
f._rql_hooked_vis = true
|
||||||
|
local origShow = f:GetScript("OnShow")
|
||||||
|
f:SetScript("OnShow", function()
|
||||||
|
if origShow then origShow() end
|
||||||
|
RQL_HideAllPlusButtons()
|
||||||
|
RQL_SchedulePlusScan(0)
|
||||||
|
end)
|
||||||
|
local origHide = f:GetScript("OnHide")
|
||||||
|
f:SetScript("OnHide", function()
|
||||||
|
if origHide then origHide() end
|
||||||
|
RQL_HideAllPlusButtons()
|
||||||
|
RQL_SchedulePlusScan(0)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Do one pass shortly after login so already-visible chat gets [+].
|
-- Do one pass shortly after login so already-visible chat gets [+].
|
||||||
RQL_SchedulePlusScan(0.3)
|
RQL_SchedulePlusScan(0.3)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user