Shader preview sliders show again after a property edit (#168)
game-maker / gate (push) Successful in 2m13s
game-maker / suite (push) Successful in 8m1s

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 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5 committed 2026-09-21 09:28:02 +02:00
1 parent 73a71473f1
commit 7063c8d074
3 files changed
+19 -2

No files matched your search

+1 -1
View File
@@ -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: The browser suite and the three example games need a machine with a GPU:
```bash ```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 # every tool signs in first – see the Accounts page
node tools/seed-jumprun.mjs && node tools/smoke-jumprun.mjs node tools/seed-jumprun.mjs && node tools/smoke-jumprun.mjs
node tools/seed-tetris.mjs && node tools/smoke-tetris.mjs node tools/seed-tetris.mjs && node tools/smoke-tetris.mjs
+3 -1
View File
@@ -185,8 +185,10 @@ export class ShaderEditor extends AssetTabEditor<ShaderAsset, GraphCanvas> {
for (const row of this.params.removeChildren()) row.destroy({ children: true }); for (const row of this.params.removeChildren()) row.destroy({ children: true });
this.sliders.clear(); this.sliders.clear();
for (const def of defs) this.params.add(this.paramRow(def)); 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.side.relayout();
this.params.relayout();
} }
for (const def of defs) { for (const def of defs) {
const row = this.sliders.get(def.key); const row = this.sliders.get(def.key);
+15
View File
@@ -809,6 +809,21 @@ export async function shader(t) {
written.declared === 1, written.declared === 1,
{ pulled, dark, written }, { 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 }); await assetProps({ texture: picture?.id ?? '', color: 0xffffff, shader: made.id, level: 0.5 });
const onSprite = await openPreview({ const onSprite = await openPreview({