diff --git a/src/editor/composition/CompositionTimeline.ts b/src/editor/composition/CompositionTimeline.ts index 5dc15ad8..bc233482 100644 --- a/src/editor/composition/CompositionTimeline.ts +++ b/src/editor/composition/CompositionTimeline.ts @@ -902,8 +902,10 @@ export class CompositionTimeline extends Widget { { label: 'Add track below', onSelect: () => this.addTrack(row + 1) }, { label: 'Move up', disabled: row === 0, onSelect: () => swap(row - 1) }, { label: 'Move down', disabled: row === asset.tracks.length - 1, onSelect: () => swap(row + 1) }, + { separator: true }, { label: 'Delete track', + danger: true, disabled: asset.tracks.length <= 1, onSelect: () => { if (this.state.execute(removeCompositionTrack(this.state.project, asset.id, track.id))) diff --git a/src/editor/inspector/compositionSection.ts b/src/editor/inspector/compositionSection.ts index 6cc65199..0979acc8 100644 --- a/src/editor/inspector/compositionSection.ts +++ b/src/editor/inspector/compositionSection.ts @@ -1,5 +1,5 @@ import { MakeProjectAssetCommand } from '../../core/commands/assetCommands'; -import { removeFromComposition, SetCompositionCommand } from '../../core/commands/compositionCommands'; +import { SetCompositionCommand } from '../../core/commands/compositionCommands'; import type { CompositionAsset, CompositionItem } from '../../core/model/Asset'; import { clipLength, @@ -13,7 +13,7 @@ import { findAsset, findAssetOf, type Project } from '../../core/model/Project'; import type { PropertyDef } from '../../core/properties/PropertySchema'; import { Button, formatNumber, type MenuEntry } from '../../ui'; import { createFieldRow } from './fieldFactory'; -import { addGap, addNameField, addNote, addTitle, type InspectorHost } from './host'; +import { addNameField, addNote, addTitle, type InspectorHost } from './host'; import { assetLink } from './objectSection'; const START_ROW = 'composition:start'; @@ -44,7 +44,7 @@ export function compositionSignature( return clipIds.length > 0 ? `clips:${clipIds.join(',')}` : 'track'; } -/** A track: its name; the timeline's menu adds, moves and deletes tracks. Clips: what they play, from when, and the way to remove them. */ +/** A track: its name; the timeline's menu adds, moves and deletes tracks. Clips: what they play and from when; the timeline's menu removes them. */ export function buildCompositionSection( host: InspectorHost, assetId: string, @@ -92,16 +92,6 @@ export function buildCompositionSection( `One pass: ${formatNumber(length / fps, 2)} s. It plays on every item of its track it overlaps.`, ); } else addTitle(host, `${clipIds.length} ANIMATION CLIPS`); - addGap(host); - host.body.add( - new Button(clipIds.length === 1 ? 'Remove clip' : 'Remove clips', { - variant: 'danger', - onClick: () => { - if (host.state.execute(removeFromComposition(host.state.project, assetId, [], clipIds))) - host.state.select({ kind: 'asset', assetId }); - }, - }), - ); } export function refreshCompositionSection( diff --git a/src/editor/song/SongTimeline.ts b/src/editor/song/SongTimeline.ts index f4163129..0974bbd7 100644 --- a/src/editor/song/SongTimeline.ts +++ b/src/editor/song/SongTimeline.ts @@ -1176,7 +1176,7 @@ export class SongTimeline extends Widget { } : { label: 'Embed a copy', disabled: !played, onSelect: () => this.embedCopy(asset, hit) }, { separator: true }, - { label: 'Delete', onSelect: () => this.deleteSelection() }, + { label: 'Delete', danger: true, onSelect: () => this.deleteSelection() }, ]).open(global.x, global.y); } @@ -1265,8 +1265,10 @@ export class SongTimeline extends Widget { { label: 'Add track below', onSelect: () => this.addTrack(row + 1) }, { label: 'Move up', disabled: row === 0, onSelect: () => swap(row - 1) }, { label: 'Move down', disabled: row === asset.tracks.length - 1, onSelect: () => swap(row + 1) }, + { separator: true }, { label: 'Delete track', + danger: true, disabled: asset.tracks.length <= 1, onSelect: () => { this.pick([], track.id);