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
@@ -133,5 +133,38 @@ export async function topbar(t) {
|
||||
(await json('__gm.state.project.name')) === projectName,
|
||||
await json('__gm.state.project.name'),
|
||||
);
|
||||
|
||||
// 46f. The symbol scale in the same dialog: 1 by default, typed down to 0.5, and every icon of the
|
||||
// scene drawn at half its side (18 → 9 world units), undone in one step.
|
||||
const iconSize = () =>
|
||||
json(`(() => {
|
||||
const p = __gm.state.project;
|
||||
const scene = p.assets.find((a) => a.id === p.activeSceneId);
|
||||
const id = (scene?.objects ?? []).map((o) => o.id).find((id) => __gm.sceneIcon(id)?.visible);
|
||||
return id ? __gm.sceneIcon(id).size : null;
|
||||
})()`);
|
||||
await clickToolbar('menu');
|
||||
await clickText('Project settings…');
|
||||
const opened = await json('__gm.projectSettings()');
|
||||
const field = await json('__gm.projectSettingsSymbolScaleAt()');
|
||||
await t.click(field.x, field.y);
|
||||
await press('a', { ctrl: true });
|
||||
await typeText('0.5');
|
||||
await press('Enter');
|
||||
await clickText('Apply');
|
||||
await sleep(200);
|
||||
const scaled = { project: await json('__gm.state.project.symbolScale'), icon: await iconSize() };
|
||||
await clickToolbar('undo');
|
||||
await sleep(200);
|
||||
const restored = { project: await json('__gm.state.project.symbolScale'), icon: await iconSize() };
|
||||
check(
|
||||
'the symbol scale starts at 1, Apply halves every scene icon, and undo gives the size back',
|
||||
opened?.symbolScale === 1 &&
|
||||
scaled.project === 0.5 &&
|
||||
Math.abs(scaled.icon - 9) < 1e-9 &&
|
||||
restored.project === 1 &&
|
||||
Math.abs(restored.icon - 18) < 1e-9,
|
||||
JSON.stringify({ opened, scaled, restored }),
|
||||
);
|
||||
await t.saved();
|
||||
}
|
||||
Reference in new issue
Block a user