refactor(webui): use Floor with Epsilon (0.001) for frame conversion calculations

This commit is contained in:
yiling
2026-06-30 10:22:32 +08:00
parent 07d82377bd
commit 1704fddc67
3 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -80,13 +80,13 @@ export const formatTimecode = (
export const formatTimestamp = (seconds: number, fps: number): string => {
if (isNaN(seconds)) return '00:00:00:00'
const frameIndex = Math.round(seconds * fps)
const frameIndex = Math.floor(seconds * fps + 0.001)
return formatTimecode(frameIndex, fps, 'timecode')
}
export const formatFrame = (seconds: number, fps: number): number => {
if (isNaN(seconds) || !fps) return 0
return Math.floor(seconds * fps)
return Math.floor(seconds * fps + 0.001)
}
export const calculateFrameCenterTime = (frameIndex: number, frameRate: number): number => {