Skip to content

fix(toolpath-desktop): fall back to transform:scale when CSS zoom unsupported#42

Merged
eliothedeman merged 1 commit into
mainfrom
eliot/issue-37-graph-zoom-fallback
Apr 22, 2026
Merged

fix(toolpath-desktop): fall back to transform:scale when CSS zoom unsupported#42
eliothedeman merged 1 commit into
mainfrom
eliot/issue-37-graph-zoom-fallback

Conversation

@eliothedeman
Copy link
Copy Markdown
Collaborator

Summary

  • The graph-view zoom in Preview.svelte applied the non-standard zoom property inline on .graph-zoom. It works in every Tauri runtime we ship against (WebKit on macOS, Chromium WebView2 on Windows/Linux), but breaks in non-WebKit/Chromium engines (Firefox dev testing, bun run dev hit from a plain browser): the visual scales while the scroll container sees unscaled dims, so scrollbars go wrong.
  • Switched the inline style to a --pg-zoom custom property and moved the zoom declaration into the stylesheet, then added an @supports not (zoom: 2) block that falls back to transform: scale with inverse-compensated width/height.
  • .path-graph inside the wrapper already has explicit px dims from dagre, so the wrapper-level calc(100% / var(--pg-zoom)) trick is sufficient — no viz.ts plumbing needed, per the minimal-fix guidance in the issue.

Test plan

  • bun run check — 0 errors (4 pre-existing a11y warnings in BrowseClaude/BrowsePi, unrelated).
  • bun run build — Vite build succeeds.
  • Manual: in Tauri WebKit the graph zooms as before and scrollbars track content bounds.
  • Manual: in Firefox (bun run dev on localhost:1420) the fallback kicks in, visuals scale, and scrollbars match.

Closes #37

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

🔍 Preview deployed: https://2ca86d45.toolpath.pages.dev

Copy link
Copy Markdown
Collaborator Author

@eliothedeman eliothedeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Yes — this implements the fix from #37 faithfully: the inline zoom: {level} is replaced with a --pg-zoom custom property, and an @supports not (zoom: 2) block in styles.css provides the transform: scale fallback with inverse-compensated width/height.

Notes

  • Preview.svelte:250style="--pg-zoom: {zoom}" on .graph-zoom is the right shape; canvasEl binding and surrounding scroll container are untouched, so WebKit/Chromium behavior is preserved (they take the zoom: var(--pg-zoom, 1) path in the stylesheet).
  • styles.css:705-720 — fallback matches the issue's recipe exactly: transform-origin: 0 0 (top-left pin so scroll offsets behave), plus width/height: calc(100% / var(--pg-zoom, 1)) to expand the wrapper since transform doesn't reflow. The concern from the issue about needing viz.ts plumbing is correctly sidestepped: .path-graph already gets explicit px dims from dagre, so 100% / zoom on the wrapper is sufficient.
  • @supports not (zoom: 2) is the correct detection idiom — the : 2 value forces it to be a real feature query. Firefox returns false here and takes the fallback; WebKit/Chromium skip it.
  • No scope creep: two files touched, no version bumps, no dependency changes, no viz.ts edits. Comments preserve the rationale from the original inline comment and explain why the fallback works.
  • No interaction risk with dagre-d3: the fallback only kicks in when zoom is unsupported, and dagre computes layout in pixel space before either path applies — the transform just rescales what's already laid out.

Verdict

LGTM — minimal, correct, matches the issue spec verbatim. (Couldn't formally approve since it's my own PR.)

…upported

The graph-view zoom in Preview.svelte applied the non-standard `zoom`
property inline on `.graph-zoom`. That works in every Tauri runtime we
ship against (WebKit on macOS, Chromium WebView2 on Windows/Linux), but
breaks if the frontend is rendered in a non-WebKit/Chromium engine
(Firefox dev testing, `bun run dev` hit from any browser): the visual
scales but the scroll container sees unscaled dims, so scrollbars are
wrong.

Switch the inline style to a `--pg-zoom` custom property and move the
`zoom` declaration into the stylesheet, then add an `@supports not
(zoom: 2)` block that falls back to `transform: scale` with inverse-
compensated `width`/`height`. `.path-graph` inside already has explicit
px dims from dagre, so the wrapper-level `calc(100% / var(--pg-zoom))`
is enough — no viz.ts plumbing needed.

Closes #37
@eliothedeman eliothedeman force-pushed the eliot/issue-37-graph-zoom-fallback branch from 94f738e to 4b1fb88 Compare April 22, 2026 21:02
@eliothedeman eliothedeman merged commit 86e153d into main Apr 22, 2026
2 checks passed
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.

toolpath-desktop: graph-view zoom depends on non-standard CSS zoom

1 participant