mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-01 16:36:56 +00:00
Scan chat bubbles once per frame with DirtiableMixin
Each chat message queued its own scan for the next frame, so a busy frame scanned the same bubbles several times. MarkDirty runs one scan for all of that frame's messages.
This commit is contained in:
+6
-7
@@ -2,7 +2,7 @@ pfUI:RegisterModule("bubbles", function ()
|
||||
|
||||
local alpha = tonumber(C.chat.bubbles.alpha)
|
||||
|
||||
pfUI.bubbles = CreateFrame("Frame", "pfChatBubbles", UIParent)
|
||||
pfUI.bubbles = Mixin(CreateFrame("Frame", "pfChatBubbles", UIParent), DirtiableMixin)
|
||||
pfUI.bubbles:RegisterEvent("CHAT_MSG_SAY")
|
||||
pfUI.bubbles:RegisterEvent("CHAT_MSG_YELL")
|
||||
pfUI.bubbles:RegisterEvent("CHAT_MSG_PARTY")
|
||||
@@ -11,12 +11,6 @@ pfUI:RegisterModule("bubbles", function ()
|
||||
pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_YELL")
|
||||
pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_PARTY")
|
||||
|
||||
pfUI.bubbles:SetScript("OnEvent", function()
|
||||
-- Bubble frames are attached to WorldFrame after the chat event fires,
|
||||
-- so wait one tick before scanning.
|
||||
RunNextFrame(function() pfUI.bubbles:ScanBubbles() end)
|
||||
end)
|
||||
|
||||
function pfUI.bubbles:ProcessBubble(f)
|
||||
f.text:Hide()
|
||||
f.text:SetFont(pfUI.font_default, tonumber(C.global.font_size) * UIParent:GetScale(), "OUTLINE")
|
||||
@@ -62,4 +56,9 @@ pfUI:RegisterModule("bubbles", function ()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Bubble frames are attached to WorldFrame after the chat event fires, so
|
||||
-- the scan waits a frame, and runs once for all of that frame's messages.
|
||||
pfUI.bubbles:SetDirtyMethod(pfUI.bubbles.ScanBubbles)
|
||||
pfUI.bubbles:SetScript("OnEvent", pfUI.bubbles.MarkDirty)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user