What
Add a zoom to fit shortcut (Z) that sets the zoom level so the
whole arrangement fits the visible timeline width.
Zoom in, zoom out and reset (⌘0) all exist; fit is the one that is
missing, and it is the one you want after working on bar 60 of a 64-bar track.
Where
lib/shortcuts/index.ts — add the registry entry (this is what makes it
rebindable and puts it in the / reference panel automatically)
app/[locale]/compose/page.tsx — bind it with useShortcut
lib/store/ui.ts — the zoom action
Suggested approach
projectEndBar() in lib/audio/scheduler.ts gives the arrangement length in
bars. Divide the container width by that, clamp to the store's MIN_ZOOM /
MAX_ZOOM, and scroll back to bar 0.
hooks/useVisibleClips.ts has useViewportWidth, which gives you the container
width and keeps it correct when panels open and close.
Done when
- Z fits the whole arrangement on screen
- It appears in the shortcuts panel and can be rebound (both come free from the
registry entry)
- An empty project doesn't produce a divide-by-zero
What
Add a zoom to fit shortcut (Z) that sets the zoom level so the
whole arrangement fits the visible timeline width.
Zoom in, zoom out and reset (⌘0) all exist; fit is the one that is
missing, and it is the one you want after working on bar 60 of a 64-bar track.
Where
lib/shortcuts/index.ts— add the registry entry (this is what makes itrebindable and puts it in the / reference panel automatically)
app/[locale]/compose/page.tsx— bind it withuseShortcutlib/store/ui.ts— the zoom actionSuggested approach
projectEndBar()inlib/audio/scheduler.tsgives the arrangement length inbars. Divide the container width by that, clamp to the store's
MIN_ZOOM/MAX_ZOOM, and scroll back to bar 0.hooks/useVisibleClips.tshasuseViewportWidth, which gives you the containerwidth and keeps it correct when panels open and close.
Done when
registry entry)