From 4cdc73ca90d403507fcfa49784f099f17c2a6202 Mon Sep 17 00:00:00 2001 From: Vixalie Date: Fri, 21 Mar 2025 16:58:35 +0800 Subject: [PATCH] add extra adjust sequence logic. --- src/context/pattern-model.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/context/pattern-model.ts b/src/context/pattern-model.ts index 258a1cd..4cad815 100644 --- a/src/context/pattern-model.ts +++ b/src/context/pattern-model.ts @@ -102,6 +102,13 @@ export function movePulseUp(pattern: Pattern, pulseId: string, step: number) { pattern.pulses[targetIndex] = currentPulse; pattern.pulses[index] = targetPulse; + // If the target pulse's order is 1, swap their offsets + if (targetPulse.order === 1) { + const tempOffset = currentPulse.offset; + currentPulse.offset = targetPulse.offset; + targetPulse.offset = tempOffset; + } + // Swap their order const tempOrder = currentPulse.order; currentPulse.order = targetPulse.order; @@ -123,6 +130,13 @@ export function movePulseDown(pattern: Pattern, pulseId: string, step: number) { pattern.pulses[targetIndex] = currentPulse; pattern.pulses[index] = targetPulse; + // If the current pulse's order is 1, swap their offsets + if (currentPulse.order === 1) { + const tempOffset = currentPulse.offset; + currentPulse.offset = targetPulse.offset; + targetPulse.offset = tempOffset; + } + // Swap their order const tempOrder = currentPulse.order; currentPulse.order = targetPulse.order;