Fixed an issue with text colors and the background bar color

This commit is contained in:
Tercio Jose
2024-02-08 00:36:37 -03:00
parent cef44035c9
commit 1c0a0eaea0
+23 -10
View File
@@ -327,6 +327,14 @@ function Details.Sort4Reverse(table1, table2) --[[exported]]
return table1[4] < table2[4]
end
function Details:GetTextColor(instanceObject, actorObject)
if (instanceObject.row_info.textL_class_colors) then
return unpack(Details.class_colors[actorObject.classe or "UNKNOW"])
else
return unpack(instanceObject.row_info.fixed_text_color)
end
end
function Details:GetBarColor(actor) --[[exported]]
actor = actor or self
@@ -2653,7 +2661,7 @@ eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", function()
end
end)
local actor_class_color_r, actor_class_color_g, actor_class_color_b
local classColor_Red, classColor_Green, classColor_Blue
-- ~texts
--[[exported]] function Details:SetInLineTexts(thisLine, valueText, perSecondText, percentText)
@@ -2992,7 +3000,7 @@ function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, ra
bForceRefresh = true
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
classColor_Red, classColor_Green, classColor_Blue = self:GetBarColor()
return self:RefreshLineValue(thisLine, instanceObject, previousData, bForceRefresh, percentNumber, bUseAnimations, total, instanceObject.top)
end
@@ -3274,18 +3282,23 @@ function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~color
end
if (instance.row_info.textL_class_colors) then
bar.lineText1:SetTextColor(r, g, b, a)
local textColor_Red, textColor_Green, textColor_Blue = Details:GetTextColor(instance, self)
bar.lineText1:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar
end
if (instance.row_info.textR_class_colors) then
bar.lineText2:SetTextColor(r, g, b, a)
bar.lineText3:SetTextColor(r, g, b, a)
bar.lineText4:SetTextColor(r, g, b, a)
local textColor_Red, textColor_Green, textColor_Blue = Details:GetTextColor(instance, self)
bar.lineText2:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText3:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText4:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
end
if (instance.row_info.backdrop.use_class_colors) then
--get the alpha from the border color
local alpha = instance.row_info.backdrop.color[4]
if (not bUseClassColor) then
r, g, b = self:GetClassColor()
end
bar.lineBorder:SetVertexColor(r, g, b, alpha)
end
end
@@ -3368,8 +3381,8 @@ function Details:SetClassIcon(texture, instance, class) --[[exported]] --~icons
elseif (class == "PET") then
texture:SetTexture(instance and instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]])
texture:SetTexCoord(0.25, 0.49609375, 0.75, 1)
actor_class_color_r, actor_class_color_g, actor_class_color_b = DetailsFramework:ParseColors(actor_class_color_r, actor_class_color_g, actor_class_color_b)
texture:SetVertexColor(actor_class_color_r, actor_class_color_g, actor_class_color_b)
classColor_Red, classColor_Green, classColor_Blue = DetailsFramework:ParseColors(classColor_Red, classColor_Green, classColor_Blue)
texture:SetVertexColor(classColor_Red, classColor_Green, classColor_Blue)
else
if (instance and instance.row_info.use_spec_icons) then
@@ -3401,7 +3414,7 @@ function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]]
end
if (fromResize) then
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
classColor_Red, classColor_Green, classColor_Blue = self:GetBarColor()
end
--icon
@@ -3415,7 +3428,7 @@ function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]]
end
--texture color
self:SetBarColors(thisLine, instance, actor_class_color_r, actor_class_color_g, actor_class_color_b)
self:SetBarColors(thisLine, instance, classColor_Red, classColor_Green, classColor_Blue)
--left text
self:SetBarLeftText(thisLine, instance, enemy, arenaEnemy, arenaAlly, UsingCustomLeftText)