mirror of
https://github.com/p-stream/p-stream.git
synced 2026-05-02 08:34:49 +00:00
disable 0-9 keyboard shortcuts when ctrl or meta is held
This commit is contained in:
parent
c6873907ef
commit
09f48baefa
1 changed files with 6 additions and 1 deletions
|
|
@ -265,7 +265,12 @@ export function KeyboardEvents() {
|
||||||
dataRef.current.display?.setTime(dataRef.current.time - 1);
|
dataRef.current.display?.setTime(dataRef.current.time - 1);
|
||||||
|
|
||||||
// Skip to percentage with number keys (0-9)
|
// Skip to percentage with number keys (0-9)
|
||||||
if (/^[0-9]$/.test(k) && dataRef.current.duration > 0) {
|
if (
|
||||||
|
/^[0-9]$/.test(k) &&
|
||||||
|
dataRef.current.duration > 0 &&
|
||||||
|
!evt.ctrlKey &&
|
||||||
|
!evt.metaKey
|
||||||
|
) {
|
||||||
const percentage = parseInt(k, 10) * 10; // 0 = 0%, 1 = 10%, 2 = 20%, ..., 9 = 90%
|
const percentage = parseInt(k, 10) * 10; // 0 = 0%, 1 = 10%, 2 = 20%, ..., 9 = 90%
|
||||||
const targetTime = (dataRef.current.duration * percentage) / 100;
|
const targetTime = (dataRef.current.duration * percentage) / 100;
|
||||||
dataRef.current.display?.setTime(targetTime);
|
dataRef.current.display?.setTime(targetTime);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue