Let the project set the size of scene view symbols
Pixel art projects draw at very different sizes, so the fixed 18 px icons of behaviors, containers and rigidbodies were too big in some projects and too small in others. The size now lives in the project settings and travels with the project. - New field Symbol scale in the project settings dialog, below Play starts. It takes 0.1 to 4 with two decimals and defaults to 1. - The value is stored as project.symbolScale. Older projects load with 1, and values out of range are clamped on load. - Every change is its own undo step through a project command. - The factor scales the icon size, the spacing of icons that share a spot, the label offset and the selection frame of icon-only symbols. - The footprints in bounds.ts that Fit uses stay as they were. The hit area follows the icon, so clicks match what is drawn. - uiHooks reports the icon size so e2e can measure it. The e2e sum in the README is 1375. That is 1374 plus one new check, and 1374 itself has not been confirmed by CI yet. Tests: - ./check.sh: 157 files, 2326 tests, CHECK EXIT 0 (before 2320). - New tests/core/symbol-scale.test.ts with 5 tests (default, save and load, clamping, undo, icon frame), one more in project-settings.test.ts. - e2e 46f: dialog opens with 1, 0.5 plus Apply gives a 9 px icon, undo gives 18 again. Module 46: ALL PASSED, 13 checks. - Counter checks: without loading the value the save and load test fails. With the icon ignoring the factor exactly 46f fails. Both originals restored per cmp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5399ef17e5
commit
5afb70a92e
14 files changed
+233
-23
No files matched your search
@@ -1,7 +1,11 @@
|
||||
/**
|
||||
* Loading, creating, switching and deleting projects, plus the top bar's menu that triggers it.
|
||||
*/
|
||||
import { RenameProjectCommand, SetCollisionLayersCommand } from '../core/commands/projectCommands';
|
||||
import {
|
||||
RenameProjectCommand,
|
||||
SetCollisionLayersCommand,
|
||||
SetSymbolScaleCommand,
|
||||
} from '../core/commands/projectCommands';
|
||||
import type { ProjectStore } from '../core/store/ProjectStore';
|
||||
import { Dialog, Menu, type MenuEntry, type Widget } from '../ui';
|
||||
import { dialogSlot } from './FormDialog';
|
||||
@@ -137,9 +141,10 @@ export class ProjectSession {
|
||||
}
|
||||
|
||||
/**
|
||||
* Name, the scene Play starts and the collision layers (#152) in one dialog (#183). The name and
|
||||
* the layers are undo steps of their own – one each, and only for what actually changed; which
|
||||
* scene Play starts is a preference of this browser, not of the project (see `settings.ts`).
|
||||
* Name, the scene Play starts, the symbol scale and the collision layers (#152) in one dialog
|
||||
* (#183). Name, symbol scale and layers are undo steps of their own – one each, and only for what
|
||||
* actually changed; which scene Play starts is a preference of this browser, not of the project
|
||||
* (see `settings.ts`).
|
||||
*/
|
||||
openProjectSettings(): ProjectSettingsDialog {
|
||||
const { project } = this.state;
|
||||
@@ -147,6 +152,7 @@ export class ProjectSession {
|
||||
name: project.name,
|
||||
playFrom: this.state.playFrom,
|
||||
collisionLayers: [...project.collisionLayers],
|
||||
symbolScale: project.symbolScale,
|
||||
};
|
||||
return this.settingsDialog.open(
|
||||
new ProjectSettingsDialog(before, (settings) => {
|
||||
@@ -154,6 +160,8 @@ export class ProjectSession {
|
||||
if (change.name !== undefined) this.state.execute(new RenameProjectCommand(change.name));
|
||||
if (change.collisionLayers !== undefined)
|
||||
this.state.execute(new SetCollisionLayersCommand(change.collisionLayers));
|
||||
if (change.symbolScale !== undefined)
|
||||
this.state.execute(new SetSymbolScaleCommand(change.symbolScale));
|
||||
this.state.setPlayFrom(change.playFrom);
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user