[PR #1490] studio: reset the camera to the current model's fitted view #1522

Open
opened 2026-11-26 20:21:32 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1490
Author: @xel1uz
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: fix/studio-reset-camera


📝 Commits (1)

  • 662f8c3 studio: reset the camera to the current model's fitted view

📊 Changes

2 files changed (+36 additions, -6 deletions)

View changed files

📝 tests/test_viewer_studio.cjs (+35 -6)
📝 viewer/studio.html (+1 -0)

📄 Description

Claimed in the coordination issue as: STUDIO-RESET-CAMERA-FIT

What and why

Load a large model in Studio, orbit or pan away, then click Reset Camera. On main the camera returns to the position captured when Studio initialized. With a 20-unit cube, the model initially fits at (30, 24, 36) but Reset moves the camera to (0, 2, 5), inside the cube.

Save the OrbitControls state after a successful model load fits the camera and updates its target. Reset now returns to the fitted view of the displayed model, including after switching models.

Tested

  • Ran the new regression against the original viewer/studio.html at 5a5df8e0b6. It failed at the first reset (expected the fitted view, got the startup position). With this change the test restores both the camera position and the orbit target after each of two model loads.
  • Clicked the toolbar button in headless Chrome 158 on Windows using the pinned Three.js r128 and real GLTFLoader. After moving the camera and panning, Reset restored the 20-unit GLB cube to (30, 24, 36) and the 6-unit cube to (9, 7.2, 10.8), both looking at the origin. On the original page the same clicks returned both cubes to (0, 2, 5). Both GLBs were generated locally.
  • node --test "tests/test_*.cjs" (Node 24.18.0): 70 passed, including all 13 Studio tests.
  • python -I scripts/run_semantic_tests.py tests/semantic -j 12: 6,223 tests across 476 files, zero failing files (396 s).
  • git diff --check and python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs passed.

GPUs tested: Chrome used ANGLE/Vulkan SwiftShader (software rendering) on Windows. No physical GPU tested.
AI-assisted: Yes.

Checklist

  • Based on upstream main at 5a5df8e0b6.
  • One topic.
  • No game data, keys or decryption.
  • Translator contract table: N/A. This changes the Studio camera.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1490 **Author:** [@xel1uz](https://github.com/xel1uz) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/studio-reset-camera` --- ### 📝 Commits (1) - [`662f8c3`](https://github.com/ubiquitarianism/leonida/commit/662f8c3df41ae3ab611f245836c6eedb578fe5a6) studio: reset the camera to the current model's fitted view ### 📊 Changes **2 files changed** (+36 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_viewer_studio.cjs` (+35 -6) 📝 `viewer/studio.html` (+1 -0) </details> ### 📄 Description Claimed in the coordination issue as: [STUDIO-RESET-CAMERA-FIT](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7149690617) ### What and why Load a large model in Studio, orbit or pan away, then click **Reset Camera**. On `main` the camera returns to the position captured when Studio initialized. With a 20-unit cube, the model initially fits at `(30, 24, 36)` but Reset moves the camera to `(0, 2, 5)`, inside the cube. Save the OrbitControls state after a successful model load fits the camera and updates its target. Reset now returns to the fitted view of the displayed model, including after switching models. ### Tested - Ran the new regression against the original `viewer/studio.html` at `5a5df8e0b6`. It failed at the first reset (expected the fitted view, got the startup position). With this change the test restores both the camera position and the orbit target after each of two model loads. - Clicked the toolbar button in headless Chrome 158 on Windows using the pinned Three.js r128 and real GLTFLoader. After moving the camera and panning, Reset restored the 20-unit GLB cube to `(30, 24, 36)` and the 6-unit cube to `(9, 7.2, 10.8)`, both looking at the origin. On the original page the same clicks returned both cubes to `(0, 2, 5)`. Both GLBs were generated locally. - `node --test "tests/test_*.cjs"` (Node 24.18.0): 70 passed, including all 13 Studio tests. - `python -I scripts/run_semantic_tests.py tests/semantic -j 12`: 6,223 tests across 476 files, zero failing files (396 s). - `git diff --check` and `python -I scripts/check_no_game_data.py viewer/studio.html tests/test_viewer_studio.cjs` passed. GPUs tested: Chrome used ANGLE/Vulkan SwiftShader (software rendering) on Windows. No physical GPU tested. AI-assisted: Yes. ### Checklist - [x] Based on upstream `main` at `5a5df8e0b6`. - [x] One topic. - [x] No game data, keys or decryption. - Translator contract table: N/A. This changes the Studio camera. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1522
No description provided.