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
@@ -85,15 +85,19 @@ export const RulerSlider: React.FC<RulerSliderProps> = ({
if (disabled) return
if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
e.preventDefault()
e.stopPropagation()
onChange((((normalizedDegree - STEP) % 360) + 360) % 360)
} else if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
e.preventDefault()
e.stopPropagation()
onChange((normalizedDegree + STEP) % 360)
} else if (e.key === 'Home') {
e.preventDefault()
e.stopPropagation()
onChange(0)
} else if (e.key === 'End') {
e.preventDefault()
e.stopPropagation()
onChange(345)
}
},