A state can transition to itself: make transition and a second click on the same state connects a self transition, taking it fires On state exited and then On state entered every time, for local and global machines, while Set state into the current state stays silent as before; only states may connect to themselves, every other node is still refused, one self transition per state; the loop is drawn over the middle of the top edge with its arrow pointing down and its name at the apex, the preview already shows it while armed, and the inspector lists it once under Transitions out; new test hook transitionLabelAt, e2e 26e5 (#163)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc285af10a
commit
010b6a7f6c
12 files changed
+355
-33
No files matched your search
@@ -80,12 +80,13 @@ export function buildTransitionSection(
|
||||
);
|
||||
}
|
||||
|
||||
/** Edges joining this state to another one, on the given side. */
|
||||
/** Edges joining this state to a state, on the given side. One back into itself is listed as going
|
||||
* out only – it is one transition, and twice in the panel it would read as two. */
|
||||
function transitionsAt(graph: Graph, nodeId: string, outgoing: boolean): GraphEdge[] {
|
||||
return graph.edges.filter((e) => {
|
||||
const [mine, other] = outgoing ? [e.from.node, e.to.node] : [e.to.node, e.from.node];
|
||||
const far = findNode(graph, other);
|
||||
return mine === nodeId && far !== undefined && isStateNode(far);
|
||||
return mine === nodeId && far !== undefined && isStateNode(far) && (outgoing || other !== nodeId);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user