fix(webui): fix arrow key frame rounding and duplicate event bubbling

- Use Math.round instead of Math.floor for keyboard arrow frame navigation in ModelViewer
- Add e.stopPropagation() to RulerSlider keyboard events to prevent duplicate bubbling to window listener
This commit is contained in:
yiling
2026-10-09 12:25:05 +08:00
parent 7c264ee447
commit 8446eaba94
3 changed files with 14 additions and 2 deletions
@@ -167,11 +167,11 @@ export const ModelViewer = React.forwardRef<MediaController, FileViewerProps>(
togglePlay()
} else if (e.key === 'ArrowLeft') {
e.preventDefault()
const currentFrame = Math.floor(currentTime * FPS)
const currentFrame = Math.round(currentTime * FPS)
seekToFrame(currentFrame - 1)
} else if (e.key === 'ArrowRight') {
e.preventDefault()
const currentFrame = Math.floor(currentTime * FPS)
const currentFrame = Math.round(currentTime * FPS)
seekToFrame(currentFrame + 1)
}
}