fix: selected dim note's MIDI item wins focus over opened item
This commit is contained in:
@@ -6260,7 +6260,20 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
// Determine which MIDI item is focused (clicked/selected note → its item; playing → item under playhead)
|
||||
var focusedItemId = focusItemId || st.target_id;
|
||||
if (selectedNoteIds && selectedNoteIds.length > 0) {
|
||||
// Most recently selected note wins: main note → opened item; dim same-track note → its item
|
||||
focusedItemId = st.target_id;
|
||||
for (var s2 = selectedNoteIds.length - 1; s2 >= 0; s2--) {
|
||||
var sid = selectedNoteIds[s2];
|
||||
if (notes.some(function(n) { return n.id === sid; })) { focusedItemId = st.target_id; break; }
|
||||
var foundGhost2 = false;
|
||||
for (var sg2 = 0; sg2 < ghostLayers.length; sg2++) {
|
||||
var sl2 = ghostLayers[sg2];
|
||||
if (!sl2.isSameTrack || !sl2.notes) continue;
|
||||
var gnote2 = sl2.notes.find(function(g) { return g.id === sid; });
|
||||
if (gnote2) { focusedItemId = gnote2.item_id || st.target_id; foundGhost2 = true; break; }
|
||||
}
|
||||
if (foundGhost2) break;
|
||||
}
|
||||
} else if (st.isPlaying && st.currentTime != null && activeTracks) {
|
||||
var curSec = st.currentTime || 0;
|
||||
var fidxTrk = activeTracks.find(function(t) { return t.id === st.trackId; });
|
||||
|
||||
Reference in New Issue
Block a user