Skip to content

Add zoom controls for the preview pane#442

Open
dpankros wants to merge 1 commit into
schuyler:mainfrom
dpankros:main
Open

Add zoom controls for the preview pane#442
dpankros wants to merge 1 commit into
schuyler:mainfrom
dpankros:main

Conversation

@dpankros

@dpankros dpankros commented Jun 3, 2026

Copy link
Copy Markdown

Summary

Adds zoom controls for the rendered preview pane:

  • View menu items: Actual Size (⌘0), Zoom In (⌘+), Zoom Out (⌘-)
  • Toolbar dropdown with preset zoom levels
  • Presets: 50%, 75%, 90%, 100%, 110%, 125%, 150%, 200%
  • ⌘+/⌘- snap to the next preset, Safari-style
  • Full page zoom: text, images, and inline elements all scale together
  • Zoom level persists across launches via NSUserDefaults
  • Existing users pick up the 100% default through preferences migration v6

Implementation uses the legacy WebView setPageSizeMultiplier: API
already exposed in WebView+WebViewPrivateHeaders.h.

Test plan

  • Unit tests in MPPreviewZoomTests.m cover default level, snap up/down
    from on- and off-preset values, min/max clamping, and Actual Size reset
  • Full test suite: 879 tests, 0 failures
  • Manual smoke test in-app

Provide Actual Size (Cmd+0), Zoom In (Cmd++), and Zoom Out (Cmd+-) menu
items plus a toolbar dropdown so users can rescale the rendered preview
for readability, presentations, or larger displays. Zoom level persists
across launches and snaps to preset increments: 50, 75, 90, 100, 110,
125, 150, and 200 percent.

Copy link
Copy Markdown
Owner

Thank you for this, @dpankros — it's genuinely the strongest of the zoom PRs. 🙏

While reviewing the cluster of zoom PRs together, one thing stood out: the other implementations route preview scaling through scaleWebview, whose body is actually disabled (#if 0, due to an old selection-offset bug), so they only end up zooming the editor font. Yours is the only one that truly zooms the rendered preview, because it uses WebKit's setPageSizeMultiplier: and sidesteps that broken path — text, images, and layout all scale together. The persistence + migration plumbing and the toolbar preset dropdown are also exactly the right shape.

We've consolidated the design across all the zoom PRs into #470, which unifies editor and preview zoom behind a single ⌘+/⌘−/⌘0 key pair, persisted as its own preference. Your PR is the basis for the preview half of that feature, and the decision to go with a persisted single preference is built directly on your approach.

No action needed from you — we'll build on your work as the starting point, layer in the editor-font scaling, and handle the menu-shortcut relocation on our side. Leaving this open for now as a building block while #470 comes together. Really appreciate the contribution!


Generated by Claude Code

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