Skip to content

feat(editor): add zoom direction preference#7552

Closed
kostyafarber wants to merge 7 commits intomainfrom
kostya/scroll-direction-preference
Closed

feat(editor): add zoom direction preference#7552
kostyafarber wants to merge 7 commits intomainfrom
kostya/scroll-direction-preference

Conversation

@kostyafarber
Copy link
Copy Markdown
Contributor

@kostyafarber kostyafarber commented Jan 2, 2026

Some users (#6164) prefer inverted scroll wheel zoom direction - scrolling up to zoom out and down to zoom in (similar to macOS "natural" scrolling). This PR adds an isZoomDirectionInverted user preference that allows users to toggle this behavior.

Change type

  • feature

Test plan

  1. Open the main menu and navigate to Preferences
  2. Toggle "Invert zoom" on
  3. Scroll on the canvas - zoom direction should now be inverted (scroll up to zoom out, scroll down to zoom in)
  4. Toggle "Invert zoom" off
  5. Verify zoom direction returns to normal (scroll up to zoom in, scroll down to zoom out)
  • Unit tests

API changes

  • Added isZoomDirectionInverted property to TLUserPreferences
  • Added getIsZoomDirectionInverted() method to UserPreferencesManager
  • Added ToggleInvertZoomItem UI component for use in menus

Release notes

  • Added a new "Invert zoom" preference that allows users to invert the scroll wheel zoom direction.

Note

Adds a user preference to invert mouse wheel zoom and wires it through storage, editor behavior, UI, and i18n.

  • Editor behavior: Applies inverted zoom in Editor wheel handling when inputMode === 'mouse' and isZoomDirectionInverted is true; exposes getIsZoomDirectionInverted() via UserPreferencesManager; updates defaults, schema validation, migrations, and versioning.
  • Persistence & schema: New isZoomDirectionInverted on TLUserPreferences and DB (030_add_zoom_direction_preference.sql); sync worker SQL and column maps updated; test helpers default updated.
  • UI: Adds ToggleInvertZoomItem under Input device submenu; disables toggle unless mouse is selected; styling updated to respect [data-disabled].
  • Translations: New strings for invert zoom and rename menu label from menu.input-mode to menu.input-device across locales.
  • Tests & API reports: Unit tests for preferences manager and camera zoom behavior; API reports updated to include new keys and menu item.

Written by Cursor Bugbot for commit 1571510. This will update automatically on new commits. Configure here.

Add a new user preference `isZoomDirectionInverted` that allows users
to invert the scroll wheel zoom direction. This is helpful for users
who prefer macOS-style "natural" scrolling or come from other software
with opposite zoom conventions.

Changes include:
- Add `isZoomDirectionInverted` to TLUserPreferences
- Add migration for the new preference
- Apply inversion in Editor.ts wheel zoom handler
- Add UI toggle in Preferences menu
- Add database migration for dotcom
- Add unit tests for the new preference

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@vercel
Copy link
Copy Markdown

vercel bot commented Jan 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
examples Ready Ready Preview Jan 22, 2026 3:26pm
5 Skipped Deployments
Project Deployment Review Updated (UTC)
analytics Ignored Ignored Preview Jan 22, 2026 3:26pm
chat-template Ignored Ignored Preview Jan 22, 2026 3:26pm
tldraw-docs Ignored Ignored Preview Jan 22, 2026 3:26pm
tldraw-shader Ignored Ignored Preview Jan 22, 2026 3:26pm
workflow-template Ignored Ignored Preview Jan 22, 2026 3:26pm

Request Review

@huppy-bot huppy-bot bot added the feature New feature label Jan 2, 2026
@kostyafarber kostyafarber assigned ds300 and unassigned ds300 Jan 2, 2026
@kostyafarber kostyafarber requested a review from ds300 January 2, 2026 13:31
@mimecuvalo
Copy link
Copy Markdown
Member

it's crazy how many files it takes to add a pref 🙃

@steveruizok
Copy link
Copy Markdown
Collaborator

Kind of not sure about this one, I think its significant that I haven't heard this request in the last five years. Not sure I'd add a preference for this if the convention is very strong.

@steveruizok
Copy link
Copy Markdown
Collaborator

I'd be okay having this in the SDK as a developer option, just thinking about the preferences menu.

@kostyafarber
Copy link
Copy Markdown
Contributor Author

Kind of not sure about this one, I think its significant that I haven't heard this request in the last five years. Not sure I'd add a preference for this if the convention is very strong.

yeah thats fair this did come off of a request here #6164. fwiw this is an option in Figma on Desktop. We could add it to the sdk but I don't feel crazy strongly about it either way.

@steveruizok
Copy link
Copy Markdown
Collaborator

Aha, well that might be enough evidence for me.

@steveruizok
Copy link
Copy Markdown
Collaborator

What do you think of this? Since we have an input dropdown here:
image

@steveruizok
Copy link
Copy Markdown
Collaborator

We might have more (e.g. disabling auto pen mode is another one I sometimes get asked about)

@kostyafarber
Copy link
Copy Markdown
Contributor Author

kostyafarber commented Jan 6, 2026

We might have more (e.g. disabling auto pen mode is another one I sometimes get asked about)

ah so you think we move all these input-y ones if and when they come in to that input mode submenu.

The pen mode one, in that submenu makes sense to me, but zoom direction I dunno. We do only zoom with input devices, but I would not naturally look for this option in an input devices menu. I'd probably heuristically think it would exist at the top level menu.

@steveruizok
Copy link
Copy Markdown
Collaborator

It looks like Figma started in a direction of putting input stuff together and should have included zoom direction here, too.

image

@steveruizok
Copy link
Copy Markdown
Collaborator

Hm, invert zoom also inverts the panning on a trackpad, which is wrong. This really is "invert wheel zoom direction" and only have an effect if mousewheel zoom is on. Which also makes me think it should be placed next to that control.

@kostyafarber
Copy link
Copy Markdown
Contributor Author

kostyafarber commented Jan 7, 2026

Ok fair, good catch, it should only affect zooming. I didn't appreciate that mouse wheel zoom option, makes sense to put it with input devices then! I'll take a look.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
multiplayer-template 5b33b39 Jan 07 2026, 04:45 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
branching-chat-template 5b33b39 Jan 07 2026, 04:45 PM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 7, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
multiplayer-template 5b33b39 Jan 07 2026, 04:49 PM

@kostyafarber
Copy link
Copy Markdown
Contributor Author

kostyafarber commented Jan 7, 2026

cc @steveruizok

  • we only invert zoom if user has specified mouse mode as their preference
  • changed the menu parent name to Input device
  • moved Invert zoom into that menu per your image
  • added some tests

kostyafarber and others added 2 commits January 7, 2026 16:57
Renamed 'Invert zoom' to 'Invert mouse zoom' in translations and UI labels for clarity. Disabled the invert zoom menu item when not in mouse input mode, and updated button styles to support [data-disabled] attribute for better accessibility and consistency.
@kostyafarber
Copy link
Copy Markdown
Contributor Author

kostyafarber commented Jan 22, 2026

closed in favour of the clean pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants