Duplicate events from one beat range into another beat range.
Only events whose startBeat and endBeat both fall within [sourceStart, sourceEnd] are copied. The copies are shifted so that sourceStart maps to targetStart.
startBeat
endBeat
[sourceStart, sourceEnd]
sourceStart
targetStart
Source events (not mutated).
Start beat of the source range (inclusive).
End beat of the source range (inclusive).
Start beat of the target range.
New array of cloned and relocated events.
// Copy beats 0-8 to start at beat 16const copies = copyEvents(layer.moveXEvents ?? [], 0, 8, 16);layer.moveXEvents = [...(layer.moveXEvents ?? []), ...copies]; Copy
// Copy beats 0-8 to start at beat 16const copies = copyEvents(layer.moveXEvents ?? [], 0, 8, 16);layer.moveXEvents = [...(layer.moveXEvents ?? []), ...copies];
Duplicate events from one beat range into another beat range.
Only events whose
startBeatandendBeatboth fall within[sourceStart, sourceEnd]are copied. The copies are shifted so thatsourceStartmaps totargetStart.