Ping an asset from its inspector link instead of selecting it (#221)
game-maker / gate (push) Successful in 2m52s
game-maker / suite (push) Successful in 9m2s

A single click on an asset link used to select the asset. That swapped
the inspector over to the asset, so the object being edited was gone
and the second click of a double-click landed on a different row. A
click now pings the asset in the asset panel, like Unity does in its
Project window, and a double-click opens it.

- state.pingAsset(id) emits a new `ping` event. It runs no command and
  leaves the selection alone, like openAsset.
- ListView.ping(id) draws an accent overlay on the row. It stays full
  for 200 ms and is gone after 1 s, driven by onFrame. destroy cancels
  the animation.
- The asset panel expands the group, scrolls to the row and pings it.
- The capture listener and followedLink in the inspector are gone.
  The inspector is no longer rebuilt, so pressCount on the label is
  enough. followsPress and pressOf are no longer exported from ui/.
- The "Asset" and "Part of" rows of a scene object were a ghost button
  that selected the asset. They are now a link label with the same
  ping and open behaviour, next to a read-only field with the name.
- The link logic lives in linkLabel() in fieldFactory.ts. createFieldRow
  and the asset row share it.
- TextField gets a readOnly option: no focus, no caret, no hover.
- New hook __gm.assetPing(). inspectorLink also reports the field
  next to the label (value, readOnly).

Findings:
- Renaming an asset while its object was selected left the old name
  in the inspector. This was already the case with the old button.
  The refresh now updates the name.

Tests:
- ./check.sh: 151 files, 2228 tests, CHECK EXIT 0 (before 150 / 2226).
  New: tests/ui/list-ping.test.ts for pingAlpha and pingAsset.
- e2e 1-16,28 on the final build: ALL PASSED, 575 checks.
  28l-ii has 9 checks instead of 5.
- Counter-checks, each failing exactly at its check: ping also selects,
  no follow-up frame (alpha stays 0.55), inspector never opens, field
  takes focus, name not refreshed, label not a link.
- Check total 1345, calculated. CI last counted 1336 at fd6af84.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-23 17:55:31 +02:00
1 parent 1aae97b335
commit 2cf72022eb
12 files changed
+282 -79

No files matched your search

+73 -9
View File
@@ -731,33 +731,97 @@ export async function shader(t) {
JSON.stringify({ textureLink, nameLink }),
);
await shot('28-shader-links');
// Folded first, so the ping has to find the row itself.
const textures = await json("__gm.assetRow('group:texture')");
await click(textures.x, textures.y);
const foldedBefore =
(await json('__gm.assetGroups()')).find((g) => g.type === 'texture').expanded === false;
const rebuildsBefore = (await json('__gm.inspectorInfo()')).rebuilds;
await click(textureLink.x, textureLink.y);
// Past the double-click window, so the next press is a fresh one.
await sleep(500);
const afterClick = {
ping: await json('__gm.assetPing()'),
row: await json(`__gm.assetRowShown(${JSON.stringify(picture?.id)})`),
selection: await json('__gm.state.selection'),
rebuilds: (await json('__gm.inspectorInfo()')).rebuilds - rebuildsBefore,
opened: await opened(),
tab: await json('__gm.tab()'),
};
await shot('28-shader-ping');
check(
'a click on the link selects the picture and opens nothing',
afterClick.selection?.kind === 'asset' &&
afterClick.selection.assetId === picture?.id &&
'a click on the link pings the picture in the asset panel: its group unfolds, its row lights up, the inspector stays',
foldedBefore &&
afterClick.ping?.id === picture?.id &&
afterClick.ping.alpha > 0 &&
Boolean(afterClick.row) &&
afterClick.selection?.kind === 'object' &&
afterClick.selection.objectId === 'oshade' &&
afterClick.rebuilds === 0 &&
afterClick.opened.length === 0 &&
afterClick.tab === 'scene',
JSON.stringify(afterClick),
JSON.stringify({ foldedBefore, afterClick }),
);
await select({ kind: 'object', holderId: 'scene1', objectIds: ['oshade'], objectId: 'oshade' });
// Past the glow and the double-click window, so the next press is a fresh one.
await sleep(1200);
const faded = await json('__gm.assetPing()');
check('the glow fades out by itself', faded === null, JSON.stringify(faded));
// Still the sprite's inspector after the ping; were it not, the link is missing and the check fails.
const shaderLink = await link('Shader');
await doubleClick(shaderLink.x, shaderLink.y);
if (shaderLink) await doubleClick(shaderLink.x, shaderLink.y);
const afterDouble = { selection: await json('__gm.state.selection'), docs: await docs() };
check(
'a double-click on the Shader link opens the shader, though the first click rebuilt the inspector',
'a double-click on the Shader link opens the shader',
afterDouble.selection?.assetId === shadedProps.shader &&
afterDouble.docs.active === `asset:${shadedProps.shader}`,
JSON.stringify({ shaderLink, afterDouble }),
);
await closeAll();
// What the object was placed from is a link too: its name beside it only reads.
await select({ kind: 'object', holderId: 'scene1', objectIds: ['oshade'], objectId: 'oshade' });
const spriteName = await json("__gm.state.project.assets.find((a) => a.id === 'shade-sprite').name");
const assetLink = await link('Asset');
if (assetLink?.field) await click(assetLink.x + 150, assetLink.y);
const focusedAfter = await json('__gm.focusedRect()');
check(
'the Asset row is a link with the name in a read-only field that takes no focus',
assetLink?.underlined === true &&
assetLink.pressable === true &&
assetLink.color === (await json("__gm.themeColor('accent')")) &&
assetLink.field?.value === spriteName &&
assetLink.field.readOnly === true &&
focusedAfter === null,
JSON.stringify({ assetLink, spriteName, focusedAfter }),
);
const assetRebuilds = (await json('__gm.inspectorInfo()')).rebuilds;
if (assetLink) await click(assetLink.x, assetLink.y);
const assetPing = {
ping: await json('__gm.assetPing()'),
selection: await json('__gm.state.selection'),
rebuilds: (await json('__gm.inspectorInfo()')).rebuilds - assetRebuilds,
};
await mutate("__gm.state.project.assets.find((a) => a.id === 'shade-sprite').name = 'Renamed sprite'");
const renamedField = (await link('Asset'))?.field?.value;
await mutate(
`__gm.state.project.assets.find((a) => a.id === 'shade-sprite').name = ${JSON.stringify(spriteName)}`,
);
check(
'a click pings the sprite and the inspector stays; renaming the sprite updates the field',
assetPing.ping?.id === 'shade-sprite' &&
assetPing.selection?.objectId === 'oshade' &&
assetPing.rebuilds === 0 &&
renamedField === 'Renamed sprite',
JSON.stringify({ assetPing, renamedField }),
);
await sleep(1200);
const assetAgain = await link('Asset');
if (assetAgain) await doubleClick(assetAgain.x, assetAgain.y);
const assetOpened = await json('__gm.state.selection');
check(
'a double-click on the Asset link opens the sprite',
assetOpened?.kind === 'asset' && assetOpened.assetId === 'shade-sprite',
JSON.stringify({ assetAgain, assetOpened }),
);
await closeAll();
await select(null);
// 28m. Time: with the clock held the pixel is a function of the second; released, a sprite wearing