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. --- Show the square indicator.
---@param data table ---@param data table
function BorderIndicator:Show(data) function BorderIndicator:Show(data)
if data.color then
self.color = data.color
end
local frame, stacks = self:GetFrame() local frame, stacks = self:GetFrame()
frame:Show() frame:Show()
end end
function BorderIndicator:Update(data)
if data.color then
self:SetColor(data.color)
end
end
function BorderIndicator:GetFrame() function BorderIndicator:GetFrame()
local frame, new = borderPool:Acquire() local frame, new = borderPool:Acquire()
if new then if new then

View File

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