Give the scene tab a header with Fit and the eye (#245)
The scene view had no header bar of its own, and its eye sat in the top bar. Switching between Scene and Game also showed two different pictures, since nothing tied the free view to the camera. - Theme.headerPadding (4) replaces Theme.padding in the top bar and in TabHeader, for the padding and for minHeight. Both bars shrink from 40 to 32 px. Nothing else uses the new value. - The new ScenePane wraps the scene view in a header bar with Fit and the visibility eye. The eye is gone from the top bar, which keeps the menu, undo and redo. - Fit with an active camera shows the world exactly as the Game tab does at its chosen step: the same zoom, and the camera centre on the same screen pixel. The rule is the pure freeViewOfCamera in viewport/view.ts, which also mirrors the letterbox snapping. - Fit without a camera frames all content on a whole step, as before. - New hook __gm.sceneHeaderAt(name). e2e 46g opens the eye there. - The doc comment above Theme.treeIndent went away in the working tree along with this. It is committed as found. Not checked: the two views only match while they have the same size. With the tilemap panel open the scene view is narrower, and Auto may pick a smaller step there. Tests: - ./check.sh: 178 files, 2575 tests, CHECK EXIT 0 - 2 new unit tests in view.test.ts: three cameras times four steps land on the same screen point as in the Game tab, Auto stays whole - e2e 3h (2 checks): a real click on Fit at Auto and at Fit, crate, camera frame and view box match in both tabs - GM_STEPS=1-3,46: ALL PASSED, 94 checks - Counter-probes: without the centre offset the unit test fails, with Fit ignoring the camera both 3h checks fail Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a90ef4c22f
commit
30de4d35a8
15 files changed
+163
-31
No files matched your search
@@ -30,6 +30,7 @@ import type { AssetTabEditor } from './AssetTabEditor';
|
||||
import { closeDocument, type DocumentRow, openDocument, replaceDocument } from './documents';
|
||||
import { ConsolePanel } from './console/ConsolePanel';
|
||||
import { GamePane } from './viewport/GamePane';
|
||||
import { ScenePane } from './viewport/ScenePane';
|
||||
import { GameViewport } from './viewport/GameViewport';
|
||||
import { SceneViewport } from './viewport/SceneViewport';
|
||||
import { TAB_OF_ASSET } from './assetTabs';
|
||||
@@ -210,8 +211,10 @@ export class Editor implements PlayHost {
|
||||
/** Beside the scene view, while exactly one placed tilemap is selected there (#142). */
|
||||
readonly tilemapPanel: TilemapPanel;
|
||||
readonly tilemapSplitter = new Splitter('x');
|
||||
/** The scene tab: its view, and the tilemap panel to its right when there is one. */
|
||||
/** The scene view, and the tilemap panel to its right when there is one. */
|
||||
private readonly sceneRow = new HStack();
|
||||
/** The scene tab: its header above `sceneRow`. */
|
||||
readonly scenePane: ScenePane;
|
||||
readonly console = new ConsolePanel();
|
||||
tab: TabId = 'scene';
|
||||
/** Frame rate, refreshed twice a second; null until the first measurement. */
|
||||
@@ -367,6 +370,7 @@ export class Editor implements PlayHost {
|
||||
};
|
||||
this.tilemapPanel.onTargetChange = () => this.syncTilemapPanel();
|
||||
this.syncTilemapPanel();
|
||||
this.scenePane = new ScenePane(state, this.viewport, this.sceneRow);
|
||||
this.assetEditors = {
|
||||
graph: this.graphEditor,
|
||||
statemachine: this.stateMachineEditor,
|
||||
@@ -380,7 +384,7 @@ export class Editor implements PlayHost {
|
||||
container: this.containerEditor,
|
||||
};
|
||||
this.panes = {
|
||||
scene: this.sceneRow,
|
||||
scene: this.scenePane,
|
||||
game: this.gamePane,
|
||||
...this.assetEditors,
|
||||
list: this.listEditor,
|
||||
|
||||
Reference in new issue
Block a user