fix: insert noteB after noteA in split, not at end of array
This commit is contained in:
@@ -6522,7 +6522,14 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
start_beat: splitBeat,
|
||||
duration_beats: target.start_beat + target.duration_beats - splitBeat
|
||||
};
|
||||
setNotes(prev => prev.map(n => n.id === target.id ? noteA : n).concat([noteB]));
|
||||
setNotes(prev => {
|
||||
const idx = prev.findIndex(n => n.id === target.id);
|
||||
if (idx === -1) return prev;
|
||||
const result = [...prev];
|
||||
result.splice(idx, 1, noteA);
|
||||
result.splice(idx + 1, 0, noteB);
|
||||
return result;
|
||||
});
|
||||
setSelectedNoteIds([noteA.id, noteB.id]);
|
||||
showToast('Đã tách nốt!', 'info');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user