arcs nicely curve when they connect a rountangle to itself

This commit is contained in:
Joeri Exelmans 2025-10-06 17:15:51 +02:00
parent e009f718d2
commit da0e56e17c
11 changed files with 526 additions and 153 deletions

View file

@ -0,0 +1,26 @@
import { ConcreteState, Statechart } from "./ast";
export function initialize(ast: Statechart): RT_Statechart {
const rt_root = recursiveEnter(ast.root) as RT_OrState;
return {
root: rt_root,
variables: new Map(),
};
}
export function recursiveEnter(state: ConcreteState): RT_ConcreteState {
if (state.kind === "and") {
return {
kind: "and",
children: state.children.map(child => recursiveEnter(child)),
};
}
else {
const currentState = state.initial[0][1];
return {
kind: "or",
current: currentState.uid,
current_rt: recursiveEnter(currentState),
};
}
}