Skip to content

Commit c9367f4

Browse files
committed
refactor(render/ui): renderingPercent
1 parent 71449cf commit c9367f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/player/Player.svelte

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import start from './main';
1515
import { EventBus } from './EventBus';
1616
import { GameStatus, type Config } from '$lib/types';
17-
import { getParams, IS_TAURI, notify, showPerformance } from '$lib/utils';
17+
import { clamp, getParams, IS_TAURI, notify, showPerformance } from '$lib/utils';
1818
import { convertTime, findPredominantBpm, getTimeSec, triggerDownload } from './utils';
1919
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
2020
import { ProgressBarStatus } from '@tauri-apps/api/window';
@@ -105,7 +105,7 @@
105105
106106
EventBus.on('rendering', (p: number) => {
107107
renderingProgress = p;
108-
renderingPercent = p / renderingTotal;
108+
renderingPercent = clamp(p / renderingTotal, 0, 1);
109109
});
110110
111111
EventBus.on('video-rendering-finished', () => {
@@ -368,7 +368,7 @@
368368
<span>
369369
{renderingPercent.toLocaleString(undefined, {
370370
style: 'percent',
371-
minimumFractionDigits: 0,
371+
minimumFractionDigits: 1,
372372
})}
373373
</span>
374374
{/if}

0 commit comments

Comments
 (0)