Refactor progress handling

probably some regressions
This commit is contained in:
NoM0Re
2025-01-22 03:37:10 +01:00
parent a643b275ba
commit 23c7da5ea6
29 changed files with 2037 additions and 1263 deletions
+4 -18
View File
@@ -54,10 +54,6 @@ local properties = {
Private.regionPrototype.AddProperties(properties, default);
local function GetProperties(data)
return properties;
end
local function create(parent)
local region = CreateFrame("Frame", nil, parent);
region.regionType = "text"
@@ -68,9 +64,6 @@ local function create(parent)
text:SetWordWrap(true);
text:SetNonSpaceWrap(true);
region.duration = 0;
region.expirationTime = math.huge;
Private.regionPrototype.create(region);
return region;
@@ -220,7 +213,7 @@ local function modify(parent, region, data)
end
end
formatters = Private.CreateFormatters(texts, getter)
formatters = Private.CreateFormatters(texts, getter, false, data)
end
local customTextFunc = nil
@@ -252,12 +245,11 @@ local function modify(parent, region, data)
Update = UpdateText or function() end
end
local TimerTick
local FrameTick
if Private.ContainsPlaceHolders(self.displayText, "p") then
TimerTick = UpdateText
FrameTick = UpdateText
end
local FrameTick
if customTextFunc and data.customTextUpdate == "update" then
if Private.ContainsCustomPlaceHolder(self.displayText) then
FrameTick = function()
@@ -269,7 +261,6 @@ local function modify(parent, region, data)
self.Update = Update
self.FrameTick = FrameTick
self.TimerTick = TimerTick
if not UpdateText then
local textStr = self.displayText
@@ -285,11 +276,6 @@ local function modify(parent, region, data)
self.subRegionEvents:RemoveSubscriber("FrameTick", self)
end
if self.TimerTick then
self.subRegionEvents:AddSubscriber("TimerTick", self, true)
else
self.subRegionEvents:RemoveSubscriber("TimerTick", self)
end
if self.Update and self.state then
self:Update()
end
@@ -347,7 +333,7 @@ local function validate(data)
Private.EnforceSubregionExists(data, "subbackground")
end
Private.RegisterRegionType("text", create, modify, default, GetProperties, validate);
Private.RegisterRegionType("text", create, modify, default, properties, validate);
-- Fallback region type