Skip to content

Studio: show one full-width tab and preserve the hidden canvas projection - #6432

Open
Racurs156 wants to merge 1 commit into
ItsNotRexed:mainfrom
Racurs156:fix/studio-tab-layout
Open

Racurs156 wants to merge 1 commit into
ItsNotRexed:mainfrom
Racurs156:fix/studio-tab-layout

Conversation

@Racurs156

Copy link
Copy Markdown

Claimed in the coordination issue.

What changed

Opening Textures left the Models panel in the flex layout. At a viewport width of 1280 px, Chrome gave roughly 628 px to Models and 652 px to Textures. Removing the ID-level display override lets the existing active-panel rule control the layout. The resize handler now waits for a nonzero canvas area before updating the projection. Switching back to Models sizes the canvas to the current viewport.

Tests

  • Headless Chrome with a synthetic empty catalog and a stub renderer. Textures occupied all 1280 px after switching, and Models occupied all 960 px after resizing the window and switching back.
  • On the rebased branch, all 4 Node Studio tests and all 20 Python gallery-server tests passed on Windows. The new test exercises zero width, zero height and a return to a visible canvas.
  • Host GPU was an NVIDIA GeForce RTX 4060 Ti, driver 621.01. The layout checks used no game files or GPU rendering.

AI-assisted.

@memorypressure

Copy link
Copy Markdown

Verified merged with main 1cc6e3c: node --test tests/test_viewer_studio.cjs passes 4/4, and the new resize test fails on clean main with camera.aspect NaN, so both the zero-size guard and the CSS diagnosis (the #models-view ID rule outranking .view-panel{display:none}) are load-bearing. Flag: this PR has no CI checks attached at all — worth a push. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@whattheflop

Copy link
Copy Markdown
Contributor

AI-assisted T3 Preview integration check on Windows. This head 96d4aab5 and #7607 c6c0ca14 merged cleanly into bf69af7c (tree 67516e3e). Studio tests passed 9/9 on main, 10/10 with this PR, and 12/12 with both (Node 24.16.0).

At a 1,280 px viewport, main left the Models panel displayed and placed the 48 px Textures panel at x=1280. The combination hid Models and displayed Textures at x=0 with all 1,280 px. A resize event with Models hidden preserved the finite camera aspect (1.284153) and canvas width; the aspect matched after switching back. With the local texture endpoint delayed by 300 ms, rapid reopen issued one request (503), the next visit retried once (200 with an empty list), and the following visit reused the result. Main issued four requests in the equivalent tab sequence. Local Three.js r128, synthetic HTTP responses, no game assets.

@morodirule

Copy link
Copy Markdown

Tested 96d4aab on Arch Linux, Node 26, CPU only: pass, first Linux check on this head. tests/test_viewer_studio.cjs 4/4 pass. Negative control: merge-base studio.html fails the hidden-canvas projection test (NaN aspect); restored, 4/4 green. Note: neighbor test_viewer_streaming.cjs has 1 failure (AbortController vm-context env issue), present with and without this PR's files — pre-existing, unrelated. No game files. AI-assisted.

@shadshuvo shadshuvo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code read (CPU) ?

Review

This fix correctly prevents invalid camera projection updates when the canvas is hidden (zero width or height).

Code Quality

  • ? Logic is correct: guard clause prevents NaN/Infinity aspect ratios
  • ? Performance: avoids unnecessary renderer.setSize() calls on hidden canvas
  • ? Comprehensive test: verifies projection preservation across multiple zero-dimension resizes
  • ? All 4 studio tests pass locally
  • ? Minimal change: 2 guard lines + CSS cleanup

Testing

nnode tests/test_viewer_studio.cjs ? 4 tests pass (including new projection preservation test) n
The test confirms that aspect ratio stays at 2.0 through three zero-dimension resize events, then correctly updates to 1.5 (900/600) when the tab reopens with valid dimensions.

Ready to merge.


Reviewed on Windows 11, Node v24.13.0 (AI-assisted)

@isfcrctfs

Copy link
Copy Markdown

checked: #643296d4aab | with: node --test tests/test_viewer_studio.cjs (Node 24.22.3) | on: Linux, CPU only, no GPU, no game files | result: PASS, 11/11 tests pass, 0 fail

Environment: Linux; no GPU (llvmpipe only), no game copy, no real WebGL. clang-cl 23.1.5 + xwin / Wine 11.22-staging available but not needed for a JS/CSS change.

What I ran, on GitHub main 5d74c2723 plus this head (clean apply):

  • node --test tests/test_viewer_studio.cjs -> 11 tests, 11 pass, 0 fail (current main has 11 Studio tests; the new projection test is among them).

Negative control (main's viewer/studio.html + this PR's test): 1 fail, the new test, NaN !== 2 - the hidden-canvas resize set the aspect to NaN - with 10 pass; restored, 11/11.
CSS read: .view-panel already carries width:100%; height:100%; display:none and .view-panel.active{display:flex}, so the removed #models-view{...display:flex} was duplicating width/height and forcing display at ID specificity, which defeated display:none for the inactive panel. That rule arrived with the studio's first commit (1f56528) and no later studio commit touched it, so this is not undoing a later decision.

Import state: not in the maintainers' forge main (tip 1812e0b). viewer/studio.html still has the #models-view rule and no zero-size guard in onWindowResize, and the 400-commit window has no Upstream PR #6432.

Not run: a real browser layout pass (the Node harness stubs the DOM and renderer), WebGL/GPU paths, retail assets.

AI-assisted.

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.

6 participants