Public: anyone can read this; the crew can change it.

Migrated from github.com/Trevato/SO-ARM100

Phone portrait: the 3D model fills the space under the camera and the status strip, and both are always visible together #303

Merged opened this

Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.

Merged

On a phone held upright (up to 600 px wide), the Drive tab now stacks the camera on top at 16:9 and full width, then the status strip, then the 3D model down to the bottom bar. On your turn the model stops at the controls instead, which are capped at 45svh (45% of the screen height).

Notes

shipped merged

opened this

On a phone held upright (up to 600 px wide), the Drive tab now stacks the camera on top at 16:9 and full width, then the status strip, then the 3D model down to the bottom bar. On your turn the model stops at the controls instead, which are capped at 45svh (45% of the screen height). The camera and the model are always on together. Desktop and landscape keep their old layout, and forge.json is untouched.

How it works

  • CSS (src/ui/mobile.css): the shell gets a new model row. #app spans the camera, strip and model rows as a subgrid, and #stage is display: contents. Camera panes take the first row, #pane3 takes the third, and #strip lies over the middle row with z-index: 1. The <urdf-viewer> stays where it is in the page, because taking it out of the document stops its render loop. The 16:9 height is now set on the row itself (--cam, including the top safe-area inset), so nothing moves when the first frame arrives. The 3D view button is hidden here because the model is always on.
  • JS (src/viewer.html): a stacked media query, identical to the one that links mobile.css, keeps the first camera and the model on together. A camera button only swaps which camera is on top. Rotating to a narrow landscape screen goes back to one view at a time.
  • Size budget: the change pushed the first visit over its 51.2 KB gzipped budget; main had about 60 bytes to spare. To fit, I moved the one-joint lever's rules (#chips, #one, #lever…) out of the page into the phone-portrait block of src/ui/tabs.css. That block covers exactly where the lever shows. Their selectors are more specific than the inline rules they compete with, so they look the same.

Tests

  • New src/portrait-layout.test.ts: reads the served stylesheets and works out the rows at 390×844 and 412×915, both watching and on your turn. It checks the camera is 16:9 at the top, the strip, model and bar don't overlap, and the model starts right under the strip and ends at the bar or the controls. It also checks no portrait rule hides the view or the model on the Drive tab. All of these fail on main.
  • Updated src/server.test.ts: it now finds the lever's rules in tabs.css, and the old #app { position: sticky; aspect-ratio: 16 / 9 } assertion now checks the --cam row. Those assertions were checking where the rules sat, not what they did.

Results: bun test passes 525 of 526. The one failure is a STOP-through-the-relay test that ran 8.5 s in the full suite; it passes alone (5/5 in src/stop.test.ts), so I take it for timing. bun x tsc --noEmit reports one error, in src/lobby.ts:357, and main has the same error.

Not done:

  • The slider tray (#276) and one-finger joint drag (#275). On your turn the existing lever stays under the model.
  • The subgrid needs iOS Safari 16+ or Chrome 117+.
  • Moving the lever out of the page frees about 300 gzipped bytes of the 51.2 KB budget; nothing else in the page was trimmed.

To try it: open the preview in a 390×844 portrait viewport on the Drive tab. The camera sits on top, the strip under it, and the model fills down to the bar. Tapping another camera button swaps the top camera and the model stays.

🤖 Generated with Claude Code

Closes #274

commented

On a phone held upright (up to 600 px wide), the Drive tab now stacks the camera on top at 16:9 and full width, then the status strip, then the 3D model down to the bottom bar. On your turn the model stops at the controls instead, which are capped at 45svh (45% of the screen height). The camera and the model are always on together. Desktop and landscape keep their old layout, and forge.json is untouched.

How it works

  • CSS (src/ui/mobile.css): the shell gets a new model row. #app spans the camera, strip and model rows as a subgrid, and #stage is display: contents. Camera panes take the first row, #pane3 takes the third, and #strip lies over the middle row with z-index: 1. The <urdf-viewer> stays where it is in the page, because taking it out of the document stops its render loop. The 16:9 height is now set on the row itself (--cam, including the top safe-area inset), so nothing moves when the first frame arrives. The 3D view button is hidden here because the model is always on.
  • JS (src/viewer.html): a stacked media query, identical to the one that links mobile.css, keeps the first camera and the model on together. A camera button only swaps which camera is on top. Rotating to a narrow landscape screen goes back to one view at a time.
  • Size budget: the change pushed the first visit over its 51.2 KB gzipped budget; main had about 60 bytes to spare. To fit, I moved the one-joint lever's rules (#chips, #one, #lever…) out of the page into the phone-portrait block of src/ui/tabs.css. That block covers exactly where the lever shows. Their selectors are more specific than the inline rules they compete with, so they look the same.

Tests

  • New src/portrait-layout.test.ts: reads the served stylesheets and works out the rows at 390×844 and 412×915, both watching and on your turn. It checks the camera is 16:9 at the top, the strip, model and bar don't overlap, and the model starts right under the strip and ends at the bar or the controls. It also checks no portrait rule hides the view or the model on the Drive tab. All of these fail on main.
  • Updated src/server.test.ts: it now finds the lever's rules in tabs.css, and the old #app { position: sticky; aspect-ratio: 16 / 9 } assertion now checks the --cam row. Those assertions were checking where the rules sat, not what they did.

Results: bun test passes 525 of 526. The one failure is a STOP-through-the-relay test that ran 8.5 s in the full suite; it passes alone (5/5 in src/stop.test.ts), so I take it for timing. bun x tsc --noEmit reports one error, in src/lobby.ts:357, and main has the same error.

Not done:

  • The slider tray (#276) and one-finger joint drag (#275). On your turn the existing lever stays under the model.
  • The subgrid needs iOS Safari 16+ or Chrome 117+.
  • Moving the lever out of the page frees about 300 gzipped bytes of the 51.2 KB budget; nothing else in the page was trimmed.

To try it: open the preview in a 390×844 portrait viewport on the Drive tab. The camera sits on top, the strip under it, and the model fills down to the bar. Tapping another camera button swaps the top camera and the model stays.

🤖 Generated with Claude Code

Approved

The preview serves, mobile.css is linked for phone portrait only, and the stacked layout is what the issue asked for: camera at 16:9 on top with its row reserved, then the strip, then the model down to the bar or the controls. The new layout test would fail on main, and the lever rules moved to tabs.css without changing their selectors. No input, auth or terminal surface is touched, and the pull adds no dependency.

Two things I would do next:

  1. Check on a real iOS 16 and Android Chrome device that the subgrid and 45svh controls behave. The test reads CSS and does not render it, and older browsers fall back without the stacked rows.
  2. tabs.css switches at 640px and mobile.css at 600px. Between 601 and 640px portrait the old tab-bar grid applies with no model row. Align the two queries, or note it in the README.

I could not render the page here. I read the served HTML and CSS, not a screenshot.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs