fix(toolpath-desktop): fall back to transform:scale when CSS zoom unsupported#42
Merged
Merged
Conversation
|
🔍 Preview deployed: https://2ca86d45.toolpath.pages.dev |
eliothedeman
commented
Apr 22, 2026
Collaborator
Author
eliothedeman
left a comment
There was a problem hiding this comment.
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:250—style="--pg-zoom: {zoom}"on.graph-zoomis the right shape;canvasElbinding and surrounding scroll container are untouched, so WebKit/Chromium behavior is preserved (they take thezoom: 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), pluswidth/height: calc(100% / var(--pg-zoom, 1))to expand the wrapper sincetransformdoesn't reflow. The concern from the issue about needingviz.tsplumbing is correctly sidestepped:.path-graphalready gets explicit px dims from dagre, so100% / zoomon the wrapper is sufficient.@supports not (zoom: 2)is the correct detection idiom — the: 2value 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.tsedits. 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
zoomis 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
94f738e to
4b1fb88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preview.svelteapplied the non-standardzoomproperty 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 devhit from a plain browser): the visual scales while the scroll container sees unscaled dims, so scrollbars go wrong.--pg-zoomcustom property and moved thezoomdeclaration into the stylesheet, then added an@supports not (zoom: 2)block that falls back totransform: scalewith inverse-compensatedwidth/height..path-graphinside the wrapper already has explicit px dims from dagre, so the wrapper-levelcalc(100% / var(--pg-zoom))trick is sufficient — noviz.tsplumbing 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.bun run devonlocalhost:1420) the fallback kicks in, visuals scale, and scrollbars match.Closes #37