mcut
@mcut/timeline

findNearestFreeSlot

Generated TypeScript API reference for the public mcut SDK.

mcut SDK


mcut SDK / timeline/src / findNearestFreeSlot

Function: findNearestFreeSlot()

function findNearestFreeSlot(
   track,
   desiredStartMs,
   durationMs,
   ignoreElementId?): number;

Defined in: packages/timeline/src/selectors.ts:130

Nearest start position to desiredStartMs where [start, start+duration) fits in track without overlap. Used by UIs to clamp drags before dispatching; the engine itself rejects overlapping commands.

Parameters

track

elements

TimelineElement[] = ...

Sorted by startMs; never overlapping in time.

hidden

boolean = ...

Visuals from this track are not rendered.

id

`t-${string}` = trackIdSchema

locked

boolean = ...

UI hint: track rejects edits. The engine does not enforce this.

magnetic

boolean = ...

When enabled, edits compact this track so clips keep no gaps between them.

muted

boolean = ...

Audio from this track is silenced.

name

string = ...

desiredStartMs

number

durationMs

number

ignoreElementId?

`e-${string}`

Returns

number

On this page