Square- and BorderIndicator now use trigger data for changing color

If the field color is supplied from trigger data, these indicators will
now change their color. Currently this change is permanent and not bound to the
trigger.
This commit is contained in:
2023-04-14 15:40:39 +02:00
parent 1f95899781
commit 45129a8635
2 changed files with 18 additions and 1 deletions

View File

@@ -70,10 +70,20 @@ end
--- Show the square indicator.
---@param data table
function BorderIndicator:Show(data)
if data.color then
self.color = data.color
end
local frame, stacks = self:GetFrame()
frame:Show()
end
function BorderIndicator:Update(data)
if data.color then
self:SetColor(data.color)
end
end
function BorderIndicator:GetFrame()
local frame, new = borderPool:Acquire()
if new then

View File

@@ -77,7 +77,11 @@ function SquareIndicator:Show(data)
stacks:SetText(numStacks)
stacks:Show()
end
frame:SetBackdropColor(unpack(self.color))
if data.color then
self:SetColor(data.color)
else
frame:SetBackdropColor(unpack(self.color))
end
frame:Show()
end
@@ -110,6 +114,9 @@ end
---@param data table
function SquareIndicator:Update(data)
if data.color then
self:SetColor(data.color)
end
local numStacks = data.stacks or 0
if numStacks > 0 then
self.stacks:SetText(numStacks)