The topbar is icons only: the leading Project dropdown, the Scene picker and the labelled Play/Pause buttons are gone and in their place stand five icon buttons - menu, undo, redo on the left, play and pause in the middle - while Notice, the save state, fps and the Account menu keep the right side; the Play button swaps its icon for a stop square while the project runs and Pause swaps for a second play sign while it is held (Button.setIcon()), and iconSpace() drops the gap between icon and label when a button has no label, which is what kept a 24 px icon button 3 px off its own centre; the menu carries New project, Open project..., a separator and Project settings..., where the picker (src/editor/OpenProjectDialog.ts) preselects the open project and marks it "open", opens on a double click and puts Delete on the left of Cancel and Open - it closes itself before it asks whether to delete, because two modals on top of each other would have left the question standing over a list it no longer speaks about - and the settings dialog (src/editor/ProjectSettingsDialog.ts) holds the name, the "Play starts" switch (Start scene / Active scene, a preference of this browser and so no command) and the collision layers from #152, which retires CollisionLayersDialog.ts and the "Collision layers..." entry; what Apply actually writes is the pure function settingsChanges(), so renaming and the layers are each their own undo step and each drop out when nothing differs; the Scene dropdown falls away without replacement, the active scene is switched by double clicking it in the Assets panel, which is the way that was there anyway; new module 46 runs last with 9 checks (no label left in the bar, the run buttons in edit mode, the four menu entries, the picker with the open project preselected, Cancel leaving the project standing, the settings dialog on the state of the project, renaming with undo and redo through the icon buttons) and it neither opens nor deletes a project, because that would pull the project out from under every earlier module; modules 8, 18 and 35 and the harness follow the new bar, 6 unit tests cover settingsChanges and 3 the icons (#183)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
defd4a86d2
commit
60d0146bde
24 files changed
+751
-284
No files matched your search
+20
-14
@@ -30,7 +30,8 @@ import { SceneViewport } from './viewport/SceneViewport';
|
||||
import { TAB_OF_ASSET } from './assetTabs';
|
||||
import { attachAutosave } from './autosave';
|
||||
import { PasswordDialog } from './auth/PasswordDialog';
|
||||
import type { CollisionLayersDialog } from './CollisionLayersDialog';
|
||||
import type { OpenProjectDialog } from './OpenProjectDialog';
|
||||
import type { ProjectSettingsDialog } from './ProjectSettingsDialog';
|
||||
import { dialogSlot } from './FormDialog';
|
||||
import { ContainerEditor } from './container/ContainerEditor';
|
||||
import { EditorRun } from './EditorRun';
|
||||
@@ -273,8 +274,7 @@ export class Editor implements PlayHost {
|
||||
this.play.liveVariables(assetId) ?? this.editorRun.liveVariables(assetId);
|
||||
|
||||
this.toolbar = new Toolbar(state, {
|
||||
openProjectMenu: (anchor) => this.projects.openProjectMenu(anchor),
|
||||
openSceneMenu: (anchor) => this.projects.openSceneMenu(anchor),
|
||||
openMainMenu: (anchor) => this.projects.openMainMenu(anchor),
|
||||
togglePlay: () => (state.mode === 'edit' ? this.play.play() : this.play.stop()),
|
||||
togglePause: () => this.play.togglePause(),
|
||||
openAccountMenu: (anchor) => this.openAccountMenu(anchor, account),
|
||||
@@ -461,9 +461,14 @@ export class Editor implements PlayHost {
|
||||
return this.passwordDialog.current();
|
||||
}
|
||||
|
||||
/** The open "Collision layers" dialog (#152), for the check scripts. */
|
||||
collisionLayersDialog(): CollisionLayersDialog | null {
|
||||
return this.projects.collisionLayersDialog();
|
||||
/** The open "Project settings" dialog (#183), for the check scripts. */
|
||||
projectSettingsDialog(): ProjectSettingsDialog | null {
|
||||
return this.projects.projectSettings();
|
||||
}
|
||||
|
||||
/** The open "Open project" dialog (#183), for the check scripts. */
|
||||
projectPickerDialog(): OpenProjectDialog | null {
|
||||
return this.projects.projectPicker();
|
||||
}
|
||||
|
||||
/** Whether `id` names a tab already – a built-in one by its own id, a plugin's by the id it gave. */
|
||||
@@ -755,18 +760,19 @@ export class Editor implements PlayHost {
|
||||
return this.editorRun.debugInfo();
|
||||
}
|
||||
|
||||
/** What the start-scene switch says, and the switch itself – for the check scripts. */
|
||||
playFromInfo(): { mode: PlayFrom; label: string; scene: string } {
|
||||
return this.toolbar.playFromInfo();
|
||||
/** Which scene Play would start, and under which of the two rules – for the check scripts. */
|
||||
playFromInfo(): { mode: PlayFrom; scene: string } {
|
||||
return { mode: this.state.playFrom, scene: this.state.sceneToPlay()?.name ?? '' };
|
||||
}
|
||||
|
||||
get playFromButton(): Widget {
|
||||
return this.toolbar.playFromButton;
|
||||
/** The two run buttons of the top bar (#183): what they show and whether they take a click. */
|
||||
runButtons(): ReturnType<Toolbar['runButtons']> {
|
||||
return this.toolbar.runButtons();
|
||||
}
|
||||
|
||||
/** The scene selector, so a check can reach it – notably while a run is on (test hook). */
|
||||
get sceneButton(): Widget {
|
||||
return this.toolbar.sceneButton;
|
||||
/** The top bar's icon buttons by name, so a check can click what carries no caption. */
|
||||
get toolbarControls(): Toolbar['controls'] {
|
||||
return this.toolbar.controls;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user