mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 10:32:41 +00:00
Add structure icon size graphics override (#4270)
## Summary Adds a new **Structure icon size** option to `GraphicsOverrides`, exposed as a slider in the Graphics Settings modal. Players can now scale how large structure icons are drawn on the map. ## Changes - **`GraphicsOverrides.ts`** — add `iconSize: z.number()` to the `structure` override schema. - **`RenderOverrides.ts`** — apply the override onto `settings.structure.iconSize` (consumed by `StructurePass`/`StructureLevelPass` shaders). - **`GraphicsSettingsModal.ts`** — add a slider (range 20–120, step 5) in the "Structure Icons" section, with getter/handler following the existing pattern. Falls back to the `render-settings.json` default of 60 when unset. - **`resources/lang/en.json`** — add `icon_size_label` / `icon_size_desc` (English only, per i18n rules). - **`tests/GraphicsOverrides.test.ts`** — schema-validation cases plus application tests (override sets the value; absence keeps the default). The setting persists via the existing `userSettings.graphicsOverrides()` localStorage flow and takes effect live through the existing `regenerateRenderSettings` wiring. ## Testing - `npx vitest tests/GraphicsOverrides.test.ts --run` — 35 passed - `tsc --noEmit` — no new type errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -41,6 +41,8 @@ describe("GraphicsOverridesSchema", () => {
|
||||
{ structure: { classicNumbers: true } },
|
||||
{ structure: { classicNumbers: false } },
|
||||
{ structure: { classicIcons: true, classicNumbers: false } },
|
||||
{ structure: { iconSize: 80 } },
|
||||
{ structure: { iconSize: 40, classicIcons: false } },
|
||||
{ name: { darkNames: true }, structure: { classicIcons: true } },
|
||||
];
|
||||
for (const c of cases) {
|
||||
@@ -262,6 +264,16 @@ describe("applyGraphicsOverrides", () => {
|
||||
expect(absent.iconAlpha).toBe(0.9);
|
||||
});
|
||||
|
||||
test("iconSize override sets structure.iconSize", () => {
|
||||
expect(gen({ structure: { iconSize: 90 } }).structure.iconSize).toBe(90);
|
||||
});
|
||||
|
||||
test("iconSize absent → keeps render-settings.json default", () => {
|
||||
const def = createRenderSettings().structure.iconSize;
|
||||
expect(gen({ structure: {} }).structure.iconSize).toBe(def);
|
||||
expect(gen({}).structure.iconSize).toBe(def);
|
||||
});
|
||||
|
||||
test("classicNumbers=true → classic bitmap font", () => {
|
||||
expect(
|
||||
gen({ structure: { classicNumbers: true } }).structureLevel.classicFont,
|
||||
|
||||
Reference in New Issue
Block a user