fix: single-item cross-track drag
Each track filters the item independently. Only target track receives the inserted item. Removes duplicate state update.
This commit is contained in:
+10
-14
@@ -12119,22 +12119,18 @@ const App = () => {
|
||||
return { ...t, sections: resS, midiItems: resM, clips: resC };
|
||||
});
|
||||
}
|
||||
const items = drag.itemType === 'section' ? (t.sections || []) : (t.midiItems || []);
|
||||
const updatedItems = items.filter(it => it.id !== drag.itemId);
|
||||
if (movedItem) {
|
||||
updatedItems.push(drag.itemType === 'section'
|
||||
? { ...movedItem, start: newStart }
|
||||
: { ...movedItem, startTime: newStart });
|
||||
}
|
||||
return prev.map(t => drag.itemType === 'section'
|
||||
? { ...t, sections: updatedItems }
|
||||
: { ...t, midiItems: updatedItems });
|
||||
return prev.map(function(tr) {
|
||||
var its = drag.itemType === 'section' ? (tr.sections || []).filter(function(it) { return it.id !== drag.itemId; }) : (tr.midiItems || []).filter(function(it) { return it.id !== drag.itemId; });
|
||||
if (tr.id === targetTrackId && movedItem) {
|
||||
its.push(drag.itemType === 'section'
|
||||
? { ...movedItem, start: newStart }
|
||||
: { ...movedItem, startTime: newStart });
|
||||
}
|
||||
return drag.itemType === 'section' ? { ...tr, sections: its } : { ...tr, midiItems: its };
|
||||
});
|
||||
});
|
||||
if (drag.trackId !== targetTrackId && typeof setDraggedSectionItem === 'function') {
|
||||
setDraggedSectionItem(function(p) { return { ...p, trackId: targetTrackId }; });
|
||||
}
|
||||
if (drag.trackId !== targetTrackId) {
|
||||
setDraggedSectionItem(prev => ({ ...prev, trackId: targetTrackId }));
|
||||
setDraggedSectionItem(function(p) { return { ...p, trackId: targetTrackId }; });
|
||||
}
|
||||
};
|
||||
const handleMouseUp = () => {
|
||||
|
||||
Reference in New Issue
Block a user