Skip to content

Commit 8fb3b34

Browse files
committed
ProgressTexture: Fix logic in UpdateTime for inversing
Boolean logic is complicated if there are 3 states. Fixes: #4948
1 parent 4e8af24 commit 8fb3b34

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

WeakAuras/RegionTypes/ProgressTexture.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,13 +1045,14 @@ local function FrameTick(self)
10451045
if (duration ~= 0) then
10461046
local remaining = expirationTime - GetTime();
10471047
progress = remaining / duration;
1048-
local inversed = (not inverse and self.inverseDirection) or (inverse and not self.inverseDirection);
1048+
local inversed = not inverse ~= not self.inverseDirection
10491049
if(inversed) then
10501050
progress = 1 - progress;
10511051
end
10521052
end
10531053

10541054
progress = progress > 0.0001 and progress or 0.0001;
1055+
10551056
if (self.useSmoothProgress) then
10561057
self.smoothProgress:SetSmoothedValue(progress);
10571058
else
@@ -1302,12 +1303,13 @@ local function modify(parent, region, data)
13021303

13031304
region:Color(data.foregroundColor[1], data.foregroundColor[2], data.foregroundColor[3], data.foregroundColor[4]);
13041305

1306+
13051307
function region:UpdateTime()
13061308
local progress = 1;
13071309
if (self.duration ~= 0) then
13081310
local remaining = self.expirationTime - GetTime()
13091311
progress = remaining / self.duration
1310-
local inversed = self.inverse ~= region.inverseDirection
1312+
local inversed = not self.inverse ~= not region.inverseDirection
13111313
if(inversed) then
13121314
progress = 1 - progress;
13131315
end

0 commit comments

Comments
 (0)