Skip to content

The open-source CapCut alternative

feat: enforce non-negative snap threshold and minimum grid interval in timeline store

Anwarul Islam9cc77b449902
diff --git a/apps/web/src/stores/timeline-store.ts b/apps/web/src/stores/timeline-store.ts
index b45f5507..2734903a 100644
--- a/apps/web/src/stores/timeline-store.ts
+++ b/apps/web/src/stores/timeline-store.ts
@@ -996,11 +996,11 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
},
setSnapThreshold: (threshold) => {
- set({ snapThreshold: threshold });
+ set({ snapThreshold: Math.max(0, threshold) }); // Ensure non-negative threshold
},
setGridInterval: (interval) => {
- set({ gridInterval: interval });
+ set({ gridInterval: Math.max(0.1, interval) }); // Ensure minimum interval
},
};
});