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) {
|
if (e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// Shift+scroll on note → change velocity
|
// Shift+scroll on note → change velocity of single note or all selected
|
||||||
const clickedNote = notes.find(n => pitch === n.pitch && mx >= n.start_beat * pixelsPerBeat && mx < (n.start_beat + n.duration_beats) * pixelsPerBeat);
|
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) {
|
if (clickedNote) {
|
||||||
const delta = e.deltaY < 0 ? 0.05 : -0.05;
|
const delta = e.deltaY < 0 ? 0.05 : -0.05;
|
||||||
|
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));
|
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 {
|
} else {
|
||||||
// Shift+scroll on empty space → horizontal scroll
|
// Shift+scroll on empty space → horizontal scroll
|
||||||
const container = gridScrollRef.current;
|
const container = gridScrollRef.current;
|
||||||
@@ -8294,7 +8299,7 @@ const App = () => {
|
|||||||
buffer: silentBuffer,
|
buffer: silentBuffer,
|
||||||
instrumentProgram: track.instrumentProgram,
|
instrumentProgram: track.instrumentProgram,
|
||||||
instrumentName: track.instrumentName,
|
instrumentName: track.instrumentName,
|
||||||
currentTime: Math.max(0, currentTime - midiItem.startTime),
|
currentTime: 0,
|
||||||
isPlaying: false,
|
isPlaying: false,
|
||||||
selectionStart: null,
|
selectionStart: null,
|
||||||
selectionEnd: null,
|
selectionEnd: null,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user