fix: shift+scroll velocity changes all selected notes
When selectedNoteIds.length > 0, shift+scroll on any note changes velocity for all selected notes. Also fixed hit-test to subtract renderBeatOffset for correct positioning in session mode.
This commit is contained in:
@@ -4810,11 +4810,16 @@ const PianoRollTabEditor = ({ st, zoom, bpm, viewportWidth, activeTracks, onClos
|
||||
|
||||
if (e.shiftKey) {
|
||||
e.preventDefault();
|
||||
// Shift+scroll on note → change velocity
|
||||
const clickedNote = notes.find(n => pitch === n.pitch && mx >= n.start_beat * pixelsPerBeat && mx < (n.start_beat + n.duration_beats) * pixelsPerBeat);
|
||||
// Shift+scroll on note → change velocity of single note or all selected
|
||||
const scrollBeat = (mx / pixelsPerBeat) - renderBeatOffset;
|
||||
const clickedNote = notes.find(n => pitch === n.pitch && scrollBeat >= n.start_beat && scrollBeat < (n.start_beat + n.duration_beats));
|
||||
if (clickedNote) {
|
||||
const delta = e.deltaY < 0 ? 0.05 : -0.05;
|
||||
setNotes(prev => prev.map(n => n.id === clickedNote.id ? { ...n, velocity: Math.max(0.05, Math.min(1, (n.velocity || 0.8) + delta)) } : n));
|
||||
if (selectedNoteIds.length > 0) {
|
||||
setNotes(prev => prev.map(n => selectedNoteIds.includes(n.id) ? { ...n, velocity: Math.max(0.05, Math.min(1, (n.velocity || 0.8) + delta)) } : n));
|
||||
} else {
|
||||
setNotes(prev => prev.map(n => n.id === clickedNote.id ? { ...n, velocity: Math.max(0.05, Math.min(1, (n.velocity || 0.8) + delta)) } : n));
|
||||
}
|
||||
} else {
|
||||
// Shift+scroll on empty space → horizontal scroll
|
||||
const container = gridScrollRef.current;
|
||||
@@ -8294,7 +8299,7 @@ const App = () => {
|
||||
buffer: silentBuffer,
|
||||
instrumentProgram: track.instrumentProgram,
|
||||
instrumentName: track.instrumentName,
|
||||
currentTime: Math.max(0, currentTime - midiItem.startTime),
|
||||
currentTime: 0,
|
||||
isPlaying: false,
|
||||
selectionStart: null,
|
||||
selectionEnd: null,
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user