feat: persist piano roll zoom level into project; fixed an issue in the horizontal auto-scrolling logic in piano roll window

This commit is contained in:
Xiaohan-Tian
2026-05-18 22:21:00 -07:00
parent 97dad696b2
commit a0fe283ab5
15 changed files with 321 additions and 22 deletions
@@ -33,6 +33,7 @@ vi.mock('../../stores/projectStore', () => ({
import {
createPendingModeSwitchRequest,
getRegionStartScrollLeft,
getRegionPlayheadRelation,
getScrollLeftForViewportRequest,
} from './PianoRoll';
@@ -57,6 +58,13 @@ describe('PianoRoll viewport switch helpers', () => {
expect(getRegionPlayheadRelation(25, 16, 24)).toBe('after');
});
it('uses the zoomed beat width when scrolling to a different region in piano-roll view', () => {
document.documentElement.style.setProperty('--region-grid-beat-width', '80px');
document.documentElement.style.setProperty('--region-grid-bar-width', 'calc(var(--region-grid-beat-width) * var(--time-signature-numerator))');
expect(getRegionStartScrollLeft(16)).toBe(1280);
});
it('centers an in-region playhead when switching to region-scope sheet view', () => {
const request = createPendingModeSwitchRequest({
playheadBeat: 20,