Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(timeline): keep a 1 ms overlap in one edit group; refresh the consumer table's line refs
EtienneLescoted0798c20d98
diff --git a/src/lib/ai-edition/timeline/timelineMap.test.ts b/src/lib/ai-edition/timeline/timelineMap.test.tsindex bdd57e20a..675601374 100644--- a/src/lib/ai-edition/timeline/timelineMap.test.ts+++ b/src/lib/ai-edition/timeline/timelineMap.test.ts@@ -847,6 +847,18 @@ describe("pills wired to the universal rules", () => {expect(resolveRegionIds(regions, "c")).toEqual(["c"]);});+ it("resolveRegionIds keeps a 1 ms overlap together too: only an exact touch splits", () => {+ const regions = anchorRegionsWithDerivedMs(+ [+ { id: "a", startMs: 2000, endMs: 6001, speed: 3 },+ { id: "b", startMs: 6000, endMs: 9000, speed: 3 },+ ],+ clips,+ ids(),+ );+ expect(resolveRegionIds(regions, "a")).toEqual(["a", "b"]);+ });+it("resizing a pill across a clip boundary re-anchors it into one fragment per clip", () => {const regions = anchorRegionsWithDerivedMs([{ id: "s", startMs: 2000, endMs: 5000, speed: 3 }],diff --git a/src/lib/ai-edition/timeline/timelineMap.ts b/src/lib/ai-edition/timeline/timelineMap.tsindex deaf82544..577f74241 100644--- a/src/lib/ai-edition/timeline/timelineMap.ts+++ b/src/lib/ai-edition/timeline/timelineMap.ts@@ -341,12 +341,12 @@ export function resolveRegionIds<let run: string[] = [];let runEndSec = Number.NEGATIVE_INFINITY;let prev: T | undefined;- // Pill members come left to right, so a run ends where a same-clip member only touches it.+ // Left to right; a same-clip member that only touches ends the run (whole ms: no epsilon).for (const memberId of resolvePillIds(regions, id, epsilonSec)) {const member = byId.get(memberId);if (!member) continue;const startSec = member.startMs / 1000;- if (prev && member.clipId === prev.clipId && startSec >= runEndSec - epsilonSec) {+ if (prev && member.clipId === prev.clipId && startSec >= runEndSec) {if (run.includes(id)) return run;run = [];runEndSec = Number.NEGATIVE_INFINITY;diff --git a/technical-documentation/architecture/timeline-model.md b/technical-documentation/architecture/timeline-model.mdindex 0c60894f5..9cae9941e 100644--- a/technical-documentation/architecture/timeline-model.md+++ b/technical-documentation/architecture/timeline-model.md@@ -299,9 +299,9 @@ in the same commit, or the project round-trips into an inconsistent state:|---|---|---|| **Document layer (ops)** | `src/lib/ai-edition/document/timeline.ts` | Region CRUD; calls `rederiveRegionMs` (cache-only) and `reanchorRegions` (rebuilds identities); routes every mutation through `timelineMap`. || **Schema v4→v5 preprocess** | `src/lib/ai-edition/schema/index.ts` (`documentSchema` v4→v5 preprocess, `:555-595`) | Re-anchors `zoomRanges`, `annotations`, `legacyEditor.speedRegions`, `legacyEditor.cameraFullscreenRegions` on every parse. The single disk-load site. |-| **Timeline UI** | `src/components/ai-edition/v4/V4Timeline.tsx` | Reads lanes through `coalesceRegionsForRuler` (`:321, :329, :337, :347`) and `coalescedTrimGroups` (`:363`); a click selects the region under the pointer, and a move/resize/delete acts on the whole pill via the store. |-| **Inspector selection pane** | `src/components/ai-edition/v4/FloatingInspector.tsx` (`SelectionPane`, `:444`) | Edits the selected region by id through `useTimeline`, which widens a property edit to that region's fragments (`resolveRegionIds`), never to the whole pill. |-| **Store / authoring (UI)** | `src/lib/ai-edition/store/useTimeline.ts` | Every `add*`, `update*Span`, `removeRegion` goes through `anchorRegionsWithDerivedMs` (`:134, :163, :278, :305, :329`) and `replacePillSpan` / `dropPillsByIds`; every property edit (`patchRegionById`) through `resolveRegionIds`. |+| **Timeline UI** | `src/components/ai-edition/v4/V4Timeline.tsx` | Reads lanes through `coalesceRegionsForRuler` (`:737, :745, :753, :763`) and `coalescedTrimGroups` (`:780`); a click selects the region under the pointer, and a move/resize/delete acts on the whole pill via the store. |+| **Inspector selection pane** | `src/components/ai-edition/v4/FloatingInspector.tsx` (`SelectionPane`, `:735`) | Edits the selected region by id through `useTimeline`, which widens a property edit to that region's fragments (`resolveRegionIds`), never to the whole pill. |+| **Store / authoring (UI)** | `src/lib/ai-edition/store/useTimeline.ts` | Every `add*`, `update*Span`, `removeRegion` goes through `anchorRegionsWithDerivedMs` (`:344, :482, :517, :556`) and `replacePillSpan` (`:753, :930, :1012, :1042`) / `dropPillsByIds` (`:1106-1118`); every property edit (`patchRegionById`, `:92`) through `resolveRegionIds`. || **Native preview scene** | `src/native/sceneDescription.ts` (`:489, :508, :517, :531`) | Calls `projectRegionsToSource` for every region kind before serialising to the native compositor. || **Native playback sync** | `src/native/useNativePlaybackSync.ts` (`:22, :39`) | Resolves the RAW playhead through `resolveNativePosition` to feed `setActiveClip` / `presentTime`. || **Native compositor overlay** | `src/components/ai-edition/NativeCompositorOverlay.tsx` (`:3, :70`) | Same — `resolveNativePosition(currentTimeSec, nativeClips, document.timeline.clips)` — to keep preview in sync with the timeline ruler. |