Skip to content

fix(layout): fit header, PSTricks diagrams and the sandbox to phone screens - #12

Merged
pyramation merged 1 commit into
mainfrom
devin/1792625260-mobile-layout
Oct 22, 2026
Merged

pyramation merged 1 commit into
mainfrom
devin/1792625260-mobile-layout

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

At 390px the page was ~506–536px wide, so phones zoomed the whole page out (tiny text, blank strip on the right). Causes and fixes:

  • Header (components/common/layout.tsx): logo + 5 links stayed on one row. Nav now flex-wraps; the redundant Home link is hidden sm:inline (the logo already links home).
  • PSTricks diagrams (components/latex.tsx): .pspicture renders at its fixed TeX pixel size (400–800px). New useFitPictures sets zoom = min(1, parentWidth / naturalWidth) per picture, re-run via ResizeObserver + MutationObserver. zoom (unlike transform) shrinks the layout box too, and the MathJax rput labels scale with it.
  • Sandbox (pages/sandbox.tsx, components/tex-editor-client.tsx): controls wrap, grid is grid-cols-1 below lg, CodeMirror gets EditorView.lineWrapping.

After: document.documentElement.scrollWidth === 390 on home, /examples/unit-circle, /sandbox at a 390px viewport. Desktop is unchanged.

Draggable diagrams: under zoom the library read pointer coordinates in screen pixels, so the dragged vector lagged behind the finger. Fixed in Mathapedia/LaTeX2JS#41. This PR needs a latex2react / @latex2js/pstricks release with that fix, then a version bump here.

Before / after (390px)

home
unit circle
sandbox

Link to Devin session: https://app.devin.ai/sessions/7fcd2deb6fb144849a9dd3f8dc116d42
Open in Devin Desktop: https://app.devin.ai/desktop/session/7fcd2deb6fb144849a9dd3f8dc116d42?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant