Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/desktop/src/routes/(window-chrome)/new-main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,9 @@ function Page() {
</div>
</WindowChromeHeader>
<Show when={signIn.isPending}>
<div class="bg-gray-1 absolute inset-0 flex items-center justify-center animate-in fade-in">
<div class="flex flex-col items-center justify-center gap-4">
<span>Singning In...</span>
<div class="flex absolute inset-0 justify-center items-center bg-gray-1 animate-in fade-in">
<div class="flex flex-col gap-4 justify-center items-center">
<span>Signing In...</span>

<Button
onClick={() => {
Expand Down
39 changes: 31 additions & 8 deletions apps/desktop/src/routes/editor/Timeline/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { produce } from "solid-js/store";

import "./styles.css";

import { useEditorContext } from "../context";
import { commands } from "~/utils/tauri";
import { FPS, OUTPUT_SIZE, useEditorContext } from "../context";
import { formatTime } from "../utils";
import { ClipTrack } from "./ClipTrack";
import { TimelineContextProvider, useTimelineContext } from "./context";
Expand Down Expand Up @@ -82,13 +83,35 @@ export function Timeline() {
zoomSegmentDragState.type !== "moving" &&
sceneSegmentDragState.type !== "moving"
) {
setEditorState(
"playbackTime",
Math.min(
secsPerPixel() * (e.clientX - left!) + transform().position,
totalDuration(),
),
);
// Guard against missing bounds and clamp computed time to [0, totalDuration()]
if (left == null) return;
const rawTime =
secsPerPixel() * (e.clientX - left) + transform().position;
const newTime = Math.min(Math.max(0, rawTime), totalDuration());

// If playing, some backends require restart to seek reliably
if (editorState.playing) {
try {
await commands.stopPlayback();

// Round to nearest frame to prevent off-by-one drift
const targetFrame = Math.round(newTime * FPS);
await commands.seekTo(targetFrame);

// If the user paused during these async ops, bail out without restarting
if (!editorState.playing) {
setEditorState("playbackTime", newTime);
return;
}

await commands.startPlayback(FPS, OUTPUT_SIZE);
setEditorState("playing", true);
} catch (err) {
console.error("Failed to seek during playback:", err);
}
}

setEditorState("playbackTime", newTime);
}
}

Expand Down
Loading