summaryrefslogtreecommitdiff
path: root/apps/web/src/hooks
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-02-23 07:09:26 +0100
committerMaze Winther <mazewinther@gmail.com>2026-02-23 07:09:26 +0100
commit744419469da403be57d30b5b19f6b43246caa57d (patch)
treed86b253652496157223261d54f51d6f7b6fd047c /apps/web/src/hooks
parent1762dc077dd512f6e8afff855b1ca6696338e0be (diff)
downloadopencut-744419469da403be57d30b5b19f6b43246caa57d.tar.gz
feat: basic ripple editing
Diffstat (limited to 'apps/web/src/hooks')
-rw-r--r--apps/web/src/hooks/actions/use-editor-actions.ts29
1 files changed, 27 insertions, 2 deletions
diff --git a/apps/web/src/hooks/actions/use-editor-actions.ts b/apps/web/src/hooks/actions/use-editor-actions.ts
index 1ce890cb..5f48fc8f 100644
--- a/apps/web/src/hooks/actions/use-editor-actions.ts
+++ b/apps/web/src/hooks/actions/use-editor-actions.ts
@@ -10,7 +10,13 @@ export function useEditorActions() {
const editor = useEditor();
const activeProject = editor.project.getActive();
const { selectedElements, setElementSelection } = useElementSelection();
- const { clipboard, setClipboard, toggleSnapping } = useTimelineStore();
+ const {
+ clipboard,
+ setClipboard,
+ toggleSnapping,
+ rippleEditingEnabled,
+ toggleRippleEditing,
+ } = useTimelineStore();
useActionHandler(
"toggle-play",
@@ -158,11 +164,21 @@ export function useEditorActions() {
if (elementsToSplit.length === 0) return;
- editor.timeline.splitElements({
+ const rightSideElements = editor.timeline.splitElements({
elements: elementsToSplit,
splitTime: currentTime,
retainSide: "right",
+ rippleEnabled: rippleEditingEnabled,
});
+
+ if (rippleEditingEnabled && rightSideElements.length > 0) {
+ const firstRightElement = editor.timeline.getElementsWithTracks({
+ elements: [rightSideElements[0]],
+ })[0];
+ if (firstRightElement) {
+ editor.playback.seek({ time: firstRightElement.element.startTime });
+ }
+ }
},
undefined,
);
@@ -198,6 +214,7 @@ export function useEditorActions() {
}
editor.timeline.deleteElements({
elements: selectedElements,
+ rippleEnabled: rippleEditingEnabled,
});
editor.selection.clearSelection();
},
@@ -296,6 +313,14 @@ export function useEditorActions() {
);
useActionHandler(
+ "toggle-ripple-editing",
+ () => {
+ toggleRippleEditing();
+ },
+ undefined,
+ );
+
+ useActionHandler(
"undo",
() => {
editor.command.undo();