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

+33
View File
@@ -0,0 +1,33 @@
/**
* A row lighting up where an asset is listed, without being selected (#221, Unity's ping). The row
* itself needs text measurement, which Node lacks – e2e 28l-ii looks at it in the browser.
*/
import { describe, expect, it } from 'vitest';
import { EditorState } from '../../src/editor/state';
import { PING_MS, pingAlpha } from '../../src/ui/widgets/ListView';
describe('pingAlpha', () => {
it('holds full for the first fifth, then fades to nothing at PING_MS', () => {
const full = pingAlpha(0);
expect(full).toBeGreaterThan(0);
expect(pingAlpha(PING_MS / 5)).toBe(full);
expect(pingAlpha(PING_MS * 0.6)).toBeCloseTo(full / 2);
expect(pingAlpha(PING_MS * 0.9)).toBeLessThan(pingAlpha(PING_MS * 0.6));
expect(pingAlpha(PING_MS)).toBe(0);
expect(pingAlpha(-1)).toBe(0);
});
});
describe('EditorState.pingAsset', () => {
it('names the asset and tells the listeners, but leaves the selection alone', () => {
const state = new EditorState();
state.select({ kind: 'asset', assetId: 'sprite' });
const heard: string[] = [];
state.on('ping', () => heard.push(state.pingedAssetId ?? ''));
state.on('selection', () => heard.push('selection'));
state.on('open', () => heard.push('open'));
state.pingAsset('texture');
expect(heard).toEqual(['texture']);
expect(state.selection).toEqual({ kind: 'asset', assetId: 'sprite' });
});
});