Asset panel: double-click opens the tab, single click only selects (#71)
game-maker / suite (push) Failing after 8m11s

One rule for every asset type: a click on an asset row selects it, a
double-click (or Enter, or creating it via +) opens its tab. Selection
alone still switches tabs only for nodes, frames and template objects.

- state.openAsset(id) = select + 'open' event; the editor maps the asset
  type to its tab via TAB_OF_ASSET. The two special clauses for state
  machine and shader assets in the selection handler are gone.
- Creating via + and importing a texture from the picker open the tab;
  paste/drop of an image only selects.
- 3 unit tests (event order, re-open of a selected asset, selection never
  fires open), 14 e2e checks in step 4.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-13 12:10:21 +02:00
1 parent 3da0ef1be2
commit 4d9c4982eb
7 files changed
+160 -15

No files matched your search

+4 -4
View File
@@ -85,15 +85,14 @@ export class AssetPanel extends Panel {
private createAsset(type: AssetType, name = ASSET_TYPE_LABELS[type], props: PropertyBag = {}): void {
const command = new CreateAssetCommand(type, nextAssetName(this.state.project, name), props);
if (this.state.execute(command)) this.state.select({ kind: 'asset', assetId: command.asset.id });
if (this.state.execute(command)) this.state.openAsset(command.asset.id);
}
/** One undo step for the asset and its frames. */
private createAnimation(texture: TextureAsset): void {
const create = new CreateAssetCommand('animation', nextAssetName(this.state.project, texture.name));
const frames = new AddAnimationFramesCommand(create.asset.id, framesOfTexture(texture));
if (this.state.execute(oneStep(create.label, [create, frames])))
this.state.select({ kind: 'asset', assetId: create.asset.id });
if (this.state.execute(oneStep(create.label, [create, frames]))) this.state.openAsset(create.asset.id);
}
/**
@@ -108,10 +107,11 @@ export class AssetPanel extends Panel {
openImagePicker({ state: this.state, textures: this.textures });
}
/** Double-click / Enter on a scene makes it the active one. Placing is a drag, not a click. */
/** Double-click / Enter opens the asset's tab; a scene also becomes the active one. Placing is a drag. */
private activate(id: string): void {
const asset = findAsset(this.state.project, id);
if (asset?.type === 'scene') this.state.execute(new SetActiveSceneCommand(id));
this.state.openAsset(id);
}
/** Where an asset's row sits on screen, so a check can pick it up by id (test hook). */