diff --git a/src/editor/inspector/edgeSection.ts b/src/editor/inspector/edgeSection.ts index 0522545b..ad6b979a 100644 --- a/src/editor/inspector/edgeSection.ts +++ b/src/editor/inspector/edgeSection.ts @@ -3,10 +3,10 @@ import { findNode, type GraphEdge, isStateNode, resolveDef, stateName } from '.. import { graphLookup } from '../../core/model/graphLookup'; import { findGraphAsset, type Project } from '../../core/model/Project'; import { textOf } from '../../core/model/Properties'; -import { Button, Label } from '../../ui'; -import { hideLinks, linkNoun, removeGraphSelection } from '../actions'; +import { Label } from '../../ui'; +import { linkNoun } from '../actions'; import { createFieldRow, labelledRow } from './fieldFactory'; -import { addGap, addNote, addTitle, type InspectorHost } from './host'; +import { addNote, addTitle, type InspectorHost } from './host'; const NAME_KEY = 'transition-name'; @@ -64,7 +64,10 @@ export function edgeSignature( return d ? [d.transition, d.from, d.output, d.to, d.input, d.type].join('|') : 'missing'; } -/** One link: where it comes from and goes to. Several: how many, and the way to delete them. */ +/** + * One link: where it comes from and goes to. Several: how many. Hiding and deleting live in the + * right-click menu of the line, not here. + */ export function buildEdgeSection( host: InspectorHost, assetId: string, @@ -72,18 +75,9 @@ export function buildEdgeSection( edgeIds: readonly string[], ): void { const noun = linkNoun(host.state, assetId); - const remove = (label: string) => - host.body.add( - new Button(label, { - variant: 'danger', - onClick: () => removeGraphSelection(host.state, assetId, [], [], edgeIds), - }), - ); if (edgeIds.length > 1) { addTitle(host, `${edgeIds.length} ${noun.toUpperCase()}S`); addNote(host, 'Delete removes all of them in one step.'); - addGap(host); - remove(`Delete ${edgeIds.length} ${noun}s`); return; } const d = describeEdge(host.state.project, assetId, edgeId); @@ -109,10 +103,6 @@ export function buildEdgeSection( fact('Input', d.input); fact('Type', d.type); } - addGap(host); - if (!d.transition) - host.body.add(new Button('Hide link', { onClick: () => hideLinks(host.state, assetId, [edgeId]) })); - remove(`Delete ${noun}`); } /** Pushes the current name into its row. False when the link is gone (rebuild). */ diff --git a/tools/e2e/06-graph.mjs b/tools/e2e/06-graph.mjs index 1914b7ce..fe20ee82 100644 --- a/tools/e2e/06-graph.mjs +++ b/tools/e2e/06-graph.mjs @@ -2009,7 +2009,9 @@ export async function graph(t) { s.selection.edgeId === 'lk-e1' && same(await drawn(), ['lk-e1']) && Boolean(await find('LINK')) && - Boolean(await find('Delete link')), + // Hiding and deleting live in the line's menu alone; the inspector only describes. + !(await find('Hide link')) && + !(await find('Delete link')), JSON.stringify({ selection: s.selection, drawn: await drawn() }), ); await press('Delete'); @@ -2042,8 +2044,7 @@ export async function graph(t) { await click(one.x, two.y + 60); await click(two.x, two.y, 'right'); const offered = Boolean(await find('Hide link')); - // The inspector shows a button of the same name; the menu's entry is the one drawn last. - const entry = await locate('Delete link', true); + const entry = await locate('Delete link'); await click(entry.x, entry.y); const afterMenu = await edges(); await undo(); diff --git a/tools/e2e/26-state-machine.mjs b/tools/e2e/26-state-machine.mjs index 02283db2..a131c47b 100644 --- a/tools/e2e/26-state-machine.mjs +++ b/tools/e2e/26-state-machine.mjs @@ -374,12 +374,12 @@ export async function stateMachine(t) { const arrowSelection = (await state()).selection; await shot('05f-picked'); check( - 'clicking a transition picks it: the inspector shows it with its name and the way to delete it', + 'clicking a transition picks it: the inspector shows it with its name and no button of its own', arrowSelection?.kind === 'edge' && arrowSelection.edgeId === alarm?.id && JSON.stringify(await json('__gm.stateMachine.pickedEdges()')) === JSON.stringify([alarm?.id]) && (await has('TRANSITION')) && - (await has('Delete transition')), + !(await has('Delete transition')), JSON.stringify({ arrowSelection, drawn: await json('__gm.stateMachine.pickedEdges()') }), ); await press('Delete');