summaryrefslogtreecommitdiff
path: root/apps/web/src/stores
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-21 18:16:54 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-21 18:16:54 +0200
commitfb51cc2597b7f167eddf74125b28d2433b96052f (patch)
treef6a11eccf476762dcecf29d28af3cc01a6238a97 /apps/web/src/stores
parent263f14ef2a83b0cc78189f764b0c1859fa392539 (diff)
parentad771a0b56f84586cb0a8e8f7a0cbdd786198c08 (diff)
downloadopencut-fb51cc2597b7f167eddf74125b28d2433b96052f.tar.gz
Merge branch 'staging'
Diffstat (limited to 'apps/web/src/stores')
-rw-r--r--apps/web/src/stores/keybindings-store.ts11
-rw-r--r--apps/web/src/stores/timeline-store.ts37
2 files changed, 38 insertions, 10 deletions
diff --git a/apps/web/src/stores/keybindings-store.ts b/apps/web/src/stores/keybindings-store.ts
index 60c71afd..3e525b86 100644
--- a/apps/web/src/stores/keybindings-store.ts
+++ b/apps/web/src/stores/keybindings-store.ts
@@ -195,6 +195,7 @@ function generateKeybindingString(ev: KeyboardEvent): ShortcutKey | null {
function getPressedKey(ev: KeyboardEvent): string | null {
// Sometimes the property code is not available on the KeyboardEvent object
const key = (ev.key ?? "").toLowerCase();
+ const code = ev.code ?? "";
// Check arrow keys
if (key.startsWith("arrow")) {
@@ -213,7 +214,15 @@ function getPressedKey(ev: KeyboardEvent): string | null {
const isLetter = key.length === 1 && key >= "a" && key <= "z";
if (isLetter) return key;
- // Check if number keys
+ // Check number keys using physical position for AZERTY support
+ if (code.startsWith("Digit")) {
+ const digit = code.slice(5);
+ if (digit.length === 1 && digit >= "0" && digit <= "9") {
+ return digit;
+ }
+ }
+
+ // Fallback for other layouts
const isDigit = key.length === 1 && key >= "0" && key <= "9";
if (isDigit) return key;
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index 1fcfc60e..01ad1635 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -106,17 +106,20 @@ interface TimelineStore {
trackId: string,
elementId: string,
trimStart: number,
- trimEnd: number
+ trimEnd: number,
+ pushHistory?: boolean
) => void;
updateElementDuration: (
trackId: string,
elementId: string,
- duration: number
+ duration: number,
+ pushHistory?: boolean
) => void;
updateElementStartTime: (
trackId: string,
elementId: string,
- startTime: number
+ startTime: number,
+ pushHistory?: boolean
) => void;
toggleTrackMute: (trackId: string) => void;
@@ -687,8 +690,14 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
updateTracksAndSave(newTracks);
},
- updateElementTrim: (trackId, elementId, trimStart, trimEnd) => {
- get().pushHistory();
+ updateElementTrim: (
+ trackId,
+ elementId,
+ trimStart,
+ trimEnd,
+ pushHistory = true
+ ) => {
+ if (pushHistory) get().pushHistory();
updateTracksAndSave(
get()._tracks.map((track) =>
track.id === trackId
@@ -705,8 +714,13 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
);
},
- updateElementDuration: (trackId, elementId, duration) => {
- get().pushHistory();
+ updateElementDuration: (
+ trackId,
+ elementId,
+ duration,
+ pushHistory = true
+ ) => {
+ if (pushHistory) get().pushHistory();
updateTracksAndSave(
get()._tracks.map((track) =>
track.id === trackId
@@ -721,8 +735,13 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
);
},
- updateElementStartTime: (trackId, elementId, startTime) => {
- get().pushHistory();
+ updateElementStartTime: (
+ trackId,
+ elementId,
+ startTime,
+ pushHistory = true
+ ) => {
+ if (pushHistory) get().pushHistory();
updateTracksAndSave(
get()._tracks.map((track) =>
track.id === trackId