-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(editor): restore scene auto-framing on load #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ActArtech
wants to merge
4
commits into
pascalorg:main
Choose a base branch
from
ActArtech:fix/camera-framing-main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+86
−6
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8566b56
fix(editor): restore scene auto-framing and stop level-follow from cl…
ActArtech 045694b
test(editor): lock camera auto-frame wiring against regressions
ActArtech 0901fcb
fix(editor): pan on levelMode change and re-pick after clearing a level
ActArtech 38f224f
fix(editor): follow the first level pick after a site-phase load
ActArtech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import { describe, expect, test } from 'bun:test' | ||
| import { readFileSync } from 'node:fs' | ||
| import { join } from 'node:path' | ||
|
|
||
| const editorRoot = join(import.meta.dir, '..') | ||
|
|
||
| function readShipped(relativeFromSrc: string): string { | ||
| return readFileSync(join(editorRoot, relativeFromSrc), 'utf8') | ||
| } | ||
|
|
||
| describe('camera auto-frame wiring (shipped sources)', () => { | ||
| test('EditorContent mounts useAutoFrame and re-emits fit-scene on viewer scene-ready', () => { | ||
| const index = readShipped('components/editor/index.tsx') | ||
| expect(index).toContain("import { useAutoFrame } from '../../hooks/use-auto-frame'") | ||
| expect(index).toContain('useAutoFrame()') | ||
| expect(index).toContain("emitter.emit('camera-controls:fit-scene'") | ||
| expect(index).toContain('isViewerSceneReady') | ||
| expect(index).toContain('computeSceneBoundsXZ') | ||
| }) | ||
|
|
||
| test('CustomCameraControls exposes __pascalCameraControls without NODE_ENV gate', () => { | ||
| const controls = readShipped('components/editor/custom-camera-controls.tsx') | ||
| expect(controls).toContain('__pascalCameraControls') | ||
| expect(controls).not.toContain("process.env.NODE_ENV !== 'development'") | ||
| expect(controls).not.toContain('process.env.NODE_ENV ===') | ||
| }) | ||
|
|
||
| test('level-follow pans on level or mode change after first load, default pose only when scene empty', () => { | ||
| const controls = readShipped('components/editor/custom-camera-controls.tsx') | ||
| expect(controls).toContain('previousLevelIdRef') | ||
| expect(controls).toContain('previousLevelModeRef') | ||
| expect(controls).toContain('Object.keys(useScene.getState().nodes).length === 0') | ||
| expect(controls).toContain('if (!levelChanged && !modeChanged) return') | ||
| expect(controls).toContain('if (!currentLevelId) return') | ||
| expect(controls).toContain('controls.current.moveTo(currentTarget.x, targetY, currentTarget.z, true)') | ||
| expect(controls).not.toContain( | ||
| 'if (!previousLevelId || previousLevelId === currentLevelId) return', | ||
| ) | ||
| expect(controls).not.toContain('skippedInitialLevelSelectRef') | ||
| }) | ||
|
|
||
| test('useAutoFrame hook still emits fit-scene on empty->non-empty edge', () => { | ||
| const hook = readShipped('hooks/use-auto-frame.ts') | ||
| expect(hook).toContain('export function useAutoFrame') | ||
| expect(hook).toContain("emitter.emit('camera-controls:fit-scene'") | ||
| expect(hook).toContain('computeSceneBoundsXZ') | ||
| }) | ||
| }) |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load framing skipped after first-person
Medium Severity
A scene that becomes ready while first-person is active never receives the restored orbit frame. The new
fit-scenere-emit is ignored in that mode, and the rewrittenfirstLoadpath then skips both the default pose and the level-follow pan when first-person ends, so the remounted orbit camera stays on the unframed default.Additional Locations (1)
packages/editor/src/components/editor/index.tsx#L1406-L1413Reviewed by Cursor Bugbot for commit 38f224f. Configure here.