Skip to content

Add scrollbars and Shift+wheel horizontal scrolling to visualisation viewports - #1

Merged
MultifokalHirn merged 1 commit into
mainfrom
copilot/add-scrollbars-to-visualisation-views
Oct 5, 2026
Merged

MultifokalHirn merged 1 commit into
mainfrom
copilot/add-scrollbars-to-visualisation-views

Conversation

Copilot AI commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The layout, patch and face views zoom well but give no intuitive way to pan sideways. This adds draggable scrollbars on both axes and Shift+wheel horizontal scrolling, as in Logic Pro and similar apps.

All changes are in src/render/Viewport.tsx, so every view that uses it gets them.

  • Wheel handling

    • Shift+wheel pans horizontally. If the browser or OS already maps Shift+wheel to deltaX, that value is used instead of deltaY.
    • Trackpad horizontal gestures (|deltaX| > |deltaY|, no Ctrl) pan too.
    • A plain wheel and Ctrl+wheel (pinch) still zoom at the cursor.
  • Scrollbars

    • Custom overlay divs with role="scrollbar" and data-testid="scrollbar-x" / scrollbar-y.
    • The scrollable range is the content box padded by half a viewport on each side, unioned with the current visible area. The thumb size and position come from the visible span within that range.
    • While a thumb is being dragged, the range is frozen at its value when the drag started. Otherwise the range would grow as the view moves and the thumb would drift away from the pointer.
    • The thumb has a minimum length of 24px.
    • Thumb pointerdown calls stopPropagation() so it doesn't trigger canvas background handlers.
    • Drag state lives in useState rather than a ref because the react-hooks/refs lint rule forbids reading refs during render.

Co-authored-by: MultifokalHirn <7870758+MultifokalHirn@users.noreply.github.com>
Copilot AI changed the title Add scrollbars and Shift+wheel horizontal scrolling to viewports Add scrollbars and Shift+wheel horizontal scrolling to visualisation viewports Oct 5, 2026
Copilot AI requested a review from MultifokalHirn October 5, 2026 07:35
@MultifokalHirn
MultifokalHirn merged commit 7072bca into main Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants