mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Pinned progress bar to 100% for sessions that can't provide timeline info ('Compact' theme)
This commit is contained in:
@@ -102,19 +102,20 @@ function SetProgressInfo(timelineProps, currentPositionMs, accentColorPalette) {
|
|||||||
// Ensure we don't divide by zero or exceed 100%
|
// Ensure we don't divide by zero or exceed 100%
|
||||||
const durationMs = timelineProps.EndTime;
|
const durationMs = timelineProps.EndTime;
|
||||||
|
|
||||||
// If the duration is 0, that means the session isn't returning any timeline info, so just put the progress at 100%
|
|
||||||
if (durationMs <= 0 || !showProgressBar)
|
|
||||||
{
|
|
||||||
progressBarTrack.style.display = 'none';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
progressBarTrack.style.display = '';
|
|
||||||
|
|
||||||
// Calculate the progress percentage
|
// Calculate the progress percentage
|
||||||
let progressPercent = durationMs > 0 ? (currentPositionMs / durationMs) * 100 : 0;
|
let progressPercent = durationMs > 0 ? (currentPositionMs / durationMs) * 100 : 0;
|
||||||
progressPercent = Math.min(100, Math.max(0, progressPercent));
|
progressPercent = Math.min(100, Math.max(0, progressPercent));
|
||||||
|
|
||||||
|
// If the duration is 0, that means the session isn't returning any timeline info, so just put the progress at 100%
|
||||||
|
if (durationMs <= 0 || !showProgressBar)
|
||||||
|
// {
|
||||||
|
// progressBarTrack.style.display = 'none';
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// progressBarTrack.style.display = '';
|
||||||
|
progressPercent = 100;
|
||||||
|
|
||||||
// Calculate how much needs to be hidden (the right-side offset)
|
// Calculate how much needs to be hidden (the right-side offset)
|
||||||
const clipRight = 100 - progressPercent;
|
const clipRight = 100 - progressPercent;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user