summaryrefslogtreecommitdiff
path: root/apps/web/src/stores
diff options
context:
space:
mode:
authorMaze <167211895+mazeincoding@users.noreply.github.com>2025-07-15 14:17:50 +0200
committerGitHub <noreply@github.com>2025-07-15 14:17:50 +0200
commitf5ed3e196a8b9c48941646f5cd8fd7676816623a (patch)
tree18bb88c1e850f8da0e66c0381220f8a04b8fefda /apps/web/src/stores
parentcb877769fba83ddb7131e103581edb14f4cf2e92 (diff)
parent1fdf2a051529e40cf7a0857d31a83057b878f08d (diff)
downloadopencut-f5ed3e196a8b9c48941646f5cd8fd7676816623a.tar.gz
Merge pull request #266 from anwarulislam/feat/snapping
feature: add timeline snapping functionality
Diffstat (limited to 'apps/web/src/stores')
-rw-r--r--apps/web/src/stores/timeline-store.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index 37b45b4a..f6b9bfd8 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -42,6 +42,12 @@ interface TimelineStore {
// Manual method if you need to force recomputation
getSortedTracks: () => TimelineTrack[];
+ // Snapping settings
+ snappingEnabled: boolean;
+
+ // Snapping actions
+ toggleSnapping: () => void;
+
// Multi-selection
selectedElements: { trackId: string; elementId: string }[];
selectElement: (trackId: string, elementId: string, multi?: boolean) => void;
@@ -203,6 +209,9 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
redoStack: [],
selectedElements: [],
+ // Snapping settings defaults
+ snappingEnabled: true,
+
getSortedTracks: () => {
const { _tracks } = get();
const tracksWithMain = ensureMainTrack(_tracks);
@@ -949,5 +958,10 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
updateTracks(defaultTracks);
set({ history: [], redoStack: [], selectedElements: [] });
},
+
+ // Snapping actions
+ toggleSnapping: () => {
+ set((state) => ({ snappingEnabled: !state.snappingEnabled }));
+ },
};
});