fix: make progress bars initialise out of view

This commit is contained in:
Lei Nelissen
2024-07-25 14:06:06 +02:00
parent 83b890192e
commit 0b13e69854
4 changed files with 8 additions and 6 deletions

View File

@@ -20,8 +20,8 @@ export function calculateProgressTranslation(
const completion = position / reference;
// GUARD: Check whether the calculated number is valid and not infinite
if (Number.isNaN(completion) || !Number.isFinite(completion)) {
return 0;
if (Number.isNaN(completion) || !Number.isFinite(completion) || !width) {
return -1_000;
}
const output = (1 - completion) * -1 * width;