From 7063c8d074f966a4ecd2f3e0874a21b3a197c367 Mon Sep 17 00:00:00 2001 From: MelekTaus Date: Mon, 21 Sep 2026 09:28:02 +0200 Subject: [PATCH] Shader preview sliders show again after a property edit (#168) Changing min, max or default of a property rebuilt the slider rows of the shader preview, but the rows stayed at 0 x 0. Only the labels were visible until the preview was resized by hand. - Widget.resize only lays out when the size changes. The row count stays the same on such an edit, so the row stack kept its height and never laid out its new children. - syncParams now relayouts the row stack itself after the column around it. Tests: - e2e 28n: a new max rebuilds the slider at 136 x 24, a click at its right end sets level 2. Red against the old build (w 0, h 0). - GM_STEPS=28,31 fresh: ALL PASSED, 106 checks (was 105) - ./check.sh: 132 files, 1952 tests, exit 0 - Check sum 1210 in README, computed (1209 + 1), CI measures it. Co-Authored-By: Claude Opus 5 --- README.md | 2 +- src/editor/shader/ShaderEditor.ts | 4 +++- tools/e2e/28-shader.mjs | 15 +++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dc97923e..9a3be8c2 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ npm run build # writes dist/ and regenerates index.html; the folder is wh The browser suite and the three example games need a machine with a GPU: ```bash -node tools/seed-e2e.mjs && node tools/e2e.mjs # the editor, 1209 checks (GM_STEPS=20 for one step) +node tools/seed-e2e.mjs && node tools/e2e.mjs # the editor, 1210 checks (GM_STEPS=20 for one step) # every tool signs in first – see the Accounts page node tools/seed-jumprun.mjs && node tools/smoke-jumprun.mjs node tools/seed-tetris.mjs && node tools/smoke-tetris.mjs diff --git a/src/editor/shader/ShaderEditor.ts b/src/editor/shader/ShaderEditor.ts index e2465177..3edadabe 100644 --- a/src/editor/shader/ShaderEditor.ts +++ b/src/editor/shader/ShaderEditor.ts @@ -185,8 +185,10 @@ export class ShaderEditor extends AssetTabEditor { for (const row of this.params.removeChildren()) row.destroy({ children: true }); this.sliders.clear(); for (const def of defs) this.params.add(this.paramRow(def)); - // The column keeps its size, so a resize would not reach the rows: the column lays out anew. + // Neither the column nor, with as many rows as before, the stack of rows changes its size, + // and a resize that changes nothing lays nothing out: both lay out anew, outside in. this.side.relayout(); + this.params.relayout(); } for (const def of defs) { const row = this.sliders.get(def.key); diff --git a/tools/e2e/28-shader.mjs b/tools/e2e/28-shader.mjs index 494bf340..fc761270 100644 --- a/tools/e2e/28-shader.mjs +++ b/tools/e2e/28-shader.mjs @@ -809,6 +809,21 @@ export async function shader(t) { written.declared === 1, { pulled, dark, written }, ); + // A changed range rebuilds the row while the column keeps its height: the new slider still gets + // its width, and its right end is the new max. + await mutate(` + __gm.state.project.assets.find((a) => a.id === ${JSON.stringify(made.id)}) + .graph.nodes.find((n) => n.id === 'level').params.max = 2;`); + await sleep(300); + const widened = await json("__gm.shader.sliderAt('level')"); + await click(widened.x + widened.w - 2, widened.y + widened.h / 2); + await sleep(300); + const pushed = await json('__gm.shader.preview()'); + check( + 'a new max rebuilds the slider at full width, and its right end is the new max', + widened.w > 40 && Math.abs(widened.w - levelSlider.w) < 1 && pushed.values.level === 2, + { levelSlider, widened, pushed }, + ); await assetProps({ texture: picture?.id ?? '', color: 0xffffff, shader: made.id, level: 0.5 }); const onSprite = await openPreview({