fix(editor): restore scene auto-framing on load - #2
Open
ActArtech wants to merge 1 commit into
Open
Conversation
…obbering it useAutoFrame was accidentally removed in e688792, so nothing emitted camera-controls:fit-scene on load; the level-follow effect's first-run default pose then reset the camera after framing on fast client-side navigations. Restore the hook, gate the default pose to scene-less editors, skip the initial null->level transition, and re-emit fit-scene once the viewer signals scene-ready. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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.
What does this PR do?
Fixes the empty-viewport camera bug (full root-cause chain documented in
wiki/empty-viewport-postmortem.md, filed by the base PR):useAutoFrame()(import + call) inpackages/editor/src/components/editor/index.tsx— it was deleted in e688792, so nothing emittedcamera-controls:fit-sceneand the camera stayed at the hardcoded(20, 20, 20)default pose on every scene load.CustomCameraControlsfrom clobbering the auto-framed pose: the first-load default pose now only applies to a scene-less editor, andmoveToonly fires on real level switches (not the initialnull → leveltransition).camera-controls:fit-sceneonce the viewer reports scene-ready, so late load-driven effects can't leave the camera unframed on fast (client-side navigation) loads.process.env.NODE_ENVgate around thewindow.__pascalCameraControlsdebug handle that threw in Turbopack-served workspace sources, leaving the handle permanently unset.How to test
bun run devinapps/editor, open/scenes, click into a large scene (e.g. Hagia Sophia ground floor) via the scene list.Screenshots / screen recording
Before/after evidence captured during the fix is documented in
wiki/empty-viewport-postmortem.md(base PR). Recording can be attached on request.Checklist
bun devbun checkto verify) —biome checkoutput on the touched files is identical at HEAD (pre-existing CRLF noise)docs/hs-standard(stacked on the documentation PR, notmain)