-
-
Notifications
You must be signed in to change notification settings - Fork 92
huge bar fix #257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
huge bar fix #257
Conversation
remove whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reviewed the PR purely on submitted code, I haven't tested anything, so I might not be grasping your intentions.
In any case, it seems there are extra code unrelated to the initial bug report. Not only that, some even seem wrong.
DBM-StatusBarTimers/DBT.lua
Outdated
timer = varianceMinTimer or varianceMaxTimer -- varianceMaxTimer here could be just normal number timer, so check for varianceMinTimer, which only exists if it's a variant timer | ||
end | ||
if not timer or (self.numBars >= 15 and not isDummy) then | ||
function DBT:CreateBar(timer, id, icon, huge, small, color, isDummy, colorType, inlineIcon, keep, fade, countdown, countdownMax) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong indentation. Revert to what it was before, with 1 line break in between functions
DBM-StatusBarTimers/DBT.lua
Outdated
-- FIX: Reset totalTime BEFORE SetTimer to ensure proper variance handling | ||
newBar.totalTime = timer | ||
newBar:SetTimer(timer) -- This can kill the timer and the timer methods don't like dead timers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call is inside SetTimer. I don't understand the need for this code nor what it tries to fix
DBM-StatusBarTimers/DBT.lua
Outdated
-- FIX: Ensure elapsed time is properly reset for variance timers | ||
-- Reset elapsed before setting it to 0 to prevent percentage calculation issues | ||
newBar.elapsed = 0 | ||
newBar:SetElapsed(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this new element you're introducing .elapsed
? I don't see it being used anywhere
DBM-StatusBarTimers/DBT.lua
Outdated
@@ -829,7 +833,6 @@ function barPrototype:SetIcon(icon) | |||
end | |||
|
|||
function barPrototype:SetColor(color) | |||
-- Fix to allow colors not require the table keys | |||
if color[1] and not color.r then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this comment?
DBM-StatusBarTimers/DBT.lua
Outdated
varianceTex:SetWidth(varianceWidth) | ||
local varianceWidth | ||
local isEnlarged = self.enlarged and not self.paused | ||
local barOptions = DBT.Options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cached DBT.Options but only used it once.
|
||
-- change SetPoints based on fillUpBars | ||
varianceTex:SetWidth(varianceWidth) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed by accident. Only wanted to remove some comments from myself
DBM-StatusBarTimers/DBT.lua
Outdated
end | ||
end | ||
timer:SetText(stringFromTimer(timerCorrectedNegative)) | ||
if fillUpBars then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation
DBM-StatusBarTimers/DBT.lua
Outdated
end | ||
timer:SetText(stringFromTimer(timerCorrectedNegative)) | ||
if fillUpBars then | ||
if currentStyle == "NoAnim" and timerValue <= enlargeTime and not enlargeHack then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove comments?
@@ -1073,7 +1085,7 @@ function barPrototype:Update(elapsed) | |||
self:ApplyStyle() | |||
DBT:UpdateBars(true) | |||
end | |||
if not paused and ((barOptions.VarianceEnabled and timerLowestValueFromVariance or timerValue) <= enlargeTime) and not self.small and not isEnlarged and isMoving ~= "enlarge" and enlargeEnabled then | |||
if not paused and timerValue <= enlargeTime and not self.small and not isEnlarged and isMoving ~= "enlarge" and enlargeEnabled then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, this was intended. The bar starts enlarging at the lowest possible time, not the highest possible.
@Ayro97 I've noticed a bug with your implementation, when Fill Up is disabled, where the bar does not enlarge at the defined time. |
fix for #252
3 key changes:
1. Correcting When the Bar Becomes Huge
The Problem: Bars with variance were becoming huge too early. The code was checking the displayed text (time until variance starts) against the enlargeTime, not the bar's actual timer.
The Solution: Change the enlargement condition in
barPrototype:Update
to always use the bar's actual timer(timerValue)
.2. Correcting the Huge Bar's Fill Level
The Problem: The huge bar's visual fullness was still a percentage of its original total duration, making it look half-empty when it should have been starting a new countdown.
The Solution: In
barPrototype:Update
, for huge "NoAnim" bars, changed the denominator in thebar:SetValue()
calculation from the originaltotaltimeValue
toenlargeTime
.3. Correcting the Huge Bar's Variance Overlay
The Problem: The shaded variance overlay was too small on huge bars because its width was also being calculated as a percentage of the original, longer duration.
The Solution: Modified the
barPrototype:SetVariance
function. Added a check to see if the bar was huge and using the "NoAnim" style. If so, change the denominator for the overlay's width calculation fromself.totalTime
toenlargeTime
.