Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Keep source speed regions anchored during clip deletion

webadderall4c9b8021d946
diff --git a/src/components/video-editor/hooks/useClipRegionCommands.ts b/src/components/video-editor/hooks/useClipRegionCommands.ts
index 198c4a37..9963c9ba 100644
--- a/src/components/video-editor/hooks/useClipRegionCommands.ts
+++ b/src/components/video-editor/hooks/useClipRegionCommands.ts
@@ -11,7 +11,7 @@ import type {
SpeedRegion,
ZoomRegion,
} from "../types";
-import { getClipSourceStartMs } from "../types";
+import { getClipSourceEndMs, getClipSourceStartMs } from "../types";
type Translator = (
key: string,
@@ -230,8 +230,14 @@ export function useClipRegionCommands({
setClipRegions(closeGap);
setZoomRegions(closeGap);
setAnnotationRegions(closeGap);
- setSpeedRegions(closeGap);
setAudioRegions(closeGap);
+ setSpeedRegions((current) =>
+ current.filter(
+ (region) =>
+ region.endMs <= getClipSourceStartMs(deletedClip) ||
+ region.startMs >= getClipSourceEndMs(deletedClip),
+ ),
+ );
}
if (selectedClipId === id) setSelectedClipId(null);
},