summaryrefslogtreecommitdiff
path: root/apps/web/src/lib/commands/timeline/element/insert-element.ts
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2026-04-15 15:45:50 +0200
committerMaze Winther <mazewinther@gmail.com>2026-04-15 15:45:50 +0200
commitc46d28891fee62ca2d3132da876af6411a41d9da (patch)
treef856f71d04c69628f26b904088d675dd298a5080 /apps/web/src/lib/commands/timeline/element/insert-element.ts
parent66e4367bc4727f1d0bcf8f869529c7518812277e (diff)
downloadopencut-c46d28891fee62ca2d3132da876af6411a41d9da.tar.gz
feat: text / custom masks, fix preview pan, refactor selection
Diffstat (limited to 'apps/web/src/lib/commands/timeline/element/insert-element.ts')
-rw-r--r--apps/web/src/lib/commands/timeline/element/insert-element.ts33
1 files changed, 21 insertions, 12 deletions
diff --git a/apps/web/src/lib/commands/timeline/element/insert-element.ts b/apps/web/src/lib/commands/timeline/element/insert-element.ts
index 0ac11ebd..0e806d6e 100644
--- a/apps/web/src/lib/commands/timeline/element/insert-element.ts
+++ b/apps/web/src/lib/commands/timeline/element/insert-element.ts
@@ -102,18 +102,25 @@ export class InsertElementCommand extends Command {
});
}
- if (asset?.type === "video" && asset?.fps) {
- editor.project.updateSettings({
- settings: { fps: floatToFrameRate(asset.fps) },
- pushHistory: false,
- });
- }
+ if (asset?.type === "video" && asset?.fps) {
+ editor.project.updateSettings({
+ settings: { fps: floatToFrameRate(asset.fps) },
+ pushHistory: false,
+ });
+ }
}
editor.timeline.updateTracks(updatedTracks);
return {
- select: [{ trackId: targetTrackId, elementId: this.elementId }],
+ selection: {
+ selectedElements: [
+ { trackId: targetTrackId, elementId: this.elementId },
+ ],
+ selectedKeyframes: [],
+ keyframeSelectionAnchor: null,
+ selectedMaskPoints: null,
+ },
};
}
@@ -173,7 +180,10 @@ export class InsertElementCommand extends Command {
if (element.type === "graphic") {
registerDefaultGraphics();
- if (!element.definitionId || !graphicsRegistry.has(element.definitionId)) {
+ if (
+ !element.definitionId ||
+ !graphicsRegistry.has(element.definitionId)
+ ) {
console.error("Graphic element must have a valid definitionId");
return false;
}
@@ -236,8 +246,8 @@ export class InsertElementCommand extends Command {
const targetTrack =
tracks.main.id === placement.trackId
? tracks.main
- : tracks.overlay.find((track) => track.id === placement.trackId) ??
- tracks.audio.find((track) => track.id === placement.trackId);
+ : (tracks.overlay.find((track) => track.id === placement.trackId) ??
+ tracks.audio.find((track) => track.id === placement.trackId));
if (!targetTrack) {
console.error("Track not found:", placement.trackId);
return null;
@@ -257,8 +267,7 @@ export class InsertElementCommand extends Command {
placementResult.kind === "existingTrack"
? {
...element,
- startTime:
- placementResult.adjustedStartTime ?? element.startTime,
+ startTime: placementResult.adjustedStartTime ?? element.startTime,
}
: element;