From 45129a8635ab9701d5a0869b16d0969c413ec79e Mon Sep 17 00:00:00 2001 From: omicron Date: Fri, 14 Apr 2023 15:40:39 +0200 Subject: [PATCH] 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. --- src/types/indicators/borderindicator.lua | 10 ++++++++++ src/types/indicators/squareindicator.lua | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/types/indicators/borderindicator.lua b/src/types/indicators/borderindicator.lua index f89cf50..53fa40c 100644 --- a/src/types/indicators/borderindicator.lua +++ b/src/types/indicators/borderindicator.lua @@ -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 diff --git a/src/types/indicators/squareindicator.lua b/src/types/indicators/squareindicator.lua index c6b283a..4d47e64 100644 --- a/src/types/indicators/squareindicator.lua +++ b/src/types/indicators/squareindicator.lua @@ -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)