fix: track button toggle bug — init Set with all track IDs
When activePlayTrackIds was null (default: all play), clicking a track created an empty Set and deleted nothing. Now initializes with all track IDs, so click toggles the clicked track off/on correctly.
This commit is contained in:
@@ -6140,10 +6140,11 @@ const beatSec = 60.0 / (parseInt(bpm) || 120);
|
||||
onClick: function() {
|
||||
if (isActive) return;
|
||||
setActivePlayTrackIds(function(prev) {
|
||||
var s = prev === null ? new Set() : new Set(prev);
|
||||
if (isPlayOn) s.delete(m._trackId);
|
||||
var allIds = allMidiItems.map(function(x) { return x._trackId; });
|
||||
var s = prev === null ? new Set(allIds) : new Set(prev);
|
||||
if (s.has(m._trackId)) s.delete(m._trackId);
|
||||
else s.add(m._trackId);
|
||||
return s.size === 0 ? null : s;
|
||||
return s.size === allIds.length ? null : s;
|
||||
});
|
||||
},
|
||||
className: "w-full flex items-center justify-center h-[18px] border-b border-zinc-900 cursor-pointer outline-none " + (isActive ? 'bg-yellow-600 text-black font-bold border-l-2 border-l-yellow-300' : (isPlayOn ? 'bg-purple-700 text-white font-semibold border-l-2 border-l-purple-400' : 'bg-zinc-800 text-zinc-500 hover:bg-zinc-700 border-l-2 border-l-transparent'))
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user