dfherr / ThreatClassic2

A simple threat meter for WoW Classic & TBC Classic, successor of ClassicThreatMeter.
31 stars 17 forks source link

[BUG] Alpha color for bar background #130

Closed Zhizhica closed 1 year ago

Zhizhica commented 1 year ago

What steps will reproduce the problem?

  1. When Bar Backdrop color alpha value is set to zero, bar backdrop becomes black instead of beeing transparent

What version of ThreatClassic2 are you using? (Stating 'latest' is not useful)

Version: 2.45 for wrath

Do you have an error log of what happened?

There is no error log, just incorret behaviour

Any additional information? (example: WoW language if not English) (Attach screenshots here if available, do not link externally)

WoW language: Russian Screenshot with error. image

I was able to fix this issue by making following changes to core/core.lua (git diff format)

@@ -311,7 +311,7 @@ function TC2:UpdateThreatBars()
             bar:SetValue(data.threatPercent)
             local color = GetColor(data.unit, data.isTanking, hasActiveIgnite)
             bar:SetStatusBarColor(unpack(color))
-            bar.bg:SetVertexColor(color[1] * C.bar.colorMod, color[2] * C.bar.colorMod, color[3] * C.bar.colorMod, C.bar.alpha)
+            bar.bg:SetVertexColor(color[1] * C.bar.colorMod, color[2] * C.bar.colorMod, color[3] * C.bar.colorMod, C.backdrop.bgColor[4])

             bar:Show()
         else
@@ -1450,6 +1450,7 @@ TC2.configTable = {
                                 cfg[2] = g
                                 cfg[3] = b
                                 cfg[4] = a
+                                C.backdrop.bgColor = cfg
                                 TC2:UpdateFrame()
                             end,
                         },

Screenshot with abovementioned changes: image

Hope it helps!

dfherr commented 1 year ago

The issue is that there is an additional background texture fully linked to the bar settings that completely needed to be removed. That makes the backdrop working as expected. I renamed a few settings to apply reasonable defaults for anyone upgrading.

dfherr commented 1 year ago

Thanks for reporting btw. Here is how i resolved it: https://github.com/dfherr/ThreatClassic2/commit/8a38a2b64f85d85ab50275b362d31f5d5c683bbb