refactor: improve timeline elements, fix few bugs

This commit is contained in:
Maze Winther
2025-07-18 18:05:15 +02:00
parent 6ce8434615
commit a9b7043829
3 changed files with 46 additions and 18 deletions
+8
View File
@@ -74,6 +74,7 @@ interface TimelineStore {
clickOffsetTime: number;
currentTime: number;
};
justFinishedDragging: boolean;
setDragState: (dragState: Partial<TimelineStore["dragState"]>) => void;
startDrag: (
elementId: string,
@@ -230,6 +231,8 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
// Snapping settings defaults
snappingEnabled: true,
justFinishedDragging: false,
getSortedTracks: () => {
const { _tracks } = get();
const tracksWithMain = ensureMainTrack(_tracks);
@@ -938,7 +941,12 @@ export const useTimelineStore = create<TimelineStore>((set, get) => {
clickOffsetTime: 0,
currentTime: 0,
},
justFinishedDragging: true,
});
setTimeout(() => {
set({ justFinishedDragging: false });
}, 50);
},
// Persistence methods