Skip to content

Commit

Permalink
Revert "Revert "Fix some regressions with text updates""
Browse files Browse the repository at this point in the history
This reverts commit 47d37a5.
  • Loading branch information
InfusOnWoW committed Jan 18, 2023
1 parent 015671a commit 6f59c28
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
6 changes: 6 additions & 0 deletions WeakAuras/RegionTypes/Text.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ local function modify(parent, region, data)
region.subRegionEvents:RemoveSubscriber("TimerTick", region)
end

if FrameTick then
region.subRegionEvents:AddSubscriber("FrameTick", region)
else
region.subRegionEvents:RemoveSubscriber("FrameTick", region)
end

if not UpdateText then
local textStr = data.displayText
textStr = textStr:gsub("\\n", "\n");
Expand Down
34 changes: 14 additions & 20 deletions WeakAuras/SubRegionTypes/SubText.lua
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ local function modify(parent, region, parentData, data, first)
parent.customTextFunc = nil
end
parent.values.custom = nil
parent.values.lastCustomTextUpdate = nil
end

local UpdateText
Expand All @@ -265,16 +266,13 @@ local function modify(parent, region, parentData, data, first)
end

local Update
if first and parent.customTextFunc then
if UpdateText then
Update = function()
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
UpdateText()
end
else
Update = function()
if parent.customTextFunc and UpdateText then
Update = function()
if parent.values.lastCustomTextUpdate ~= GetTime() then
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.lastCustomTextUpdate = GetTime()
end
UpdateText()
end
else
Update = UpdateText
Expand All @@ -287,20 +285,13 @@ local function modify(parent, region, parentData, data, first)

local FrameTick
if parent.customTextFunc and parentData.customTextUpdate == "update" then
if first then
if Private.ContainsCustomPlaceHolder(data.text_text) then
FrameTick = function()
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
UpdateText()
end
else
FrameTick = function()
if Private.ContainsCustomPlaceHolder(data.text_text) then
FrameTick = function()
if parent.values.lastCustomTextUpdate ~= GetTime() then
parent.values.custom = Private.RunCustomTextFunc(parent, parent.customTextFunc)
parent.values.lastCustomTextUpdate = GetTime()
end
end
else
if Private.ContainsCustomPlaceHolder(data.text_text) then
FrameTick = UpdateText
UpdateText()
end
end
end
Expand Down Expand Up @@ -356,6 +347,9 @@ local function modify(parent, region, parentData, data, first)
if self.TimerTick then
parent.subRegionEvents:AddSubscriber("TimerTick", region)
end
if self.Update then
self:Update()
end
else
if self.Update then
parent.subRegionEvents:RemoveSubscriber("Update", region)
Expand Down

0 comments on commit 6f59c28

Please sign in to comment.