Handle backtick earlier + Ignore commands when cmd/atl is pressed + prevent -0.0 as subtitle delay

This commit is contained in:
Isra 2025-11-09 13:45:24 +08:00
parent 375fb7fc24
commit f90520d020
2 changed files with 9 additions and 2 deletions

View file

@ -181,7 +181,11 @@ export function CaptionDelay(props: {
setIsFocused(true);
}}
>
{textTransformer(props.value.toFixed(props.decimalsAllowed ?? 0))}
{textTransformer(
props.value.toFixed(props.decimalsAllowed ?? 0) === "-0.0"
? "0.0"
: props.value.toFixed(props.decimalsAllowed ?? 0),
)}
</button>
)}

View file

@ -29,6 +29,9 @@ export function useGlobalKeyboardEvents() {
return;
}
// Cancel if command or alt is pressed
if (event.metaKey || event.altKey) return;
// Handle backtick (`) key hold for keyboard commands
if (event.key === "`") {
// Prevent default browser behavior (console opening in some browsers)
@ -40,7 +43,7 @@ export function useGlobalKeyboardEvents() {
// Show modal after 500ms hold
holdTimeoutRef.current = setTimeout(() => {
showKeyboardCommands();
}, 500);
}, 150);
}
}