parse transitions
This commit is contained in:
parent
f40e7f60b5
commit
5d95e99e63
1 changed files with 16 additions and 1 deletions
|
|
@ -38,7 +38,6 @@ export function parseStatechart(state: VisualEditorState): [Statechart, [string,
|
||||||
// iterate in reverse:
|
// iterate in reverse:
|
||||||
for (let i=parentCandidates.length-1; i>=0; i--) {
|
for (let i=parentCandidates.length-1; i>=0; i--) {
|
||||||
const candidate = parentCandidates[i];
|
const candidate = parentCandidates[i];
|
||||||
console.log('candidate:', candidate, 'rt:', rt);
|
|
||||||
if (candidate.uid === "root" || isEntirelyWithin(rt, candidate)) {
|
if (candidate.uid === "root" || isEntirelyWithin(rt, candidate)) {
|
||||||
// found our parent :)
|
// found our parent :)
|
||||||
const parentState = uid2State.get(candidate.uid);
|
const parentState = uid2State.get(candidate.uid);
|
||||||
|
|
@ -79,6 +78,22 @@ export function parseStatechart(state: VisualEditorState): [Statechart, [string,
|
||||||
if (!tgtUID) {
|
if (!tgtUID) {
|
||||||
errorShapes.push([arr.uid, "Needs target"]);
|
errorShapes.push([arr.uid, "Needs target"]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// add transition
|
||||||
|
const transition: Transition = {
|
||||||
|
uid: arr.uid,
|
||||||
|
src: uid2State.get(srcUID)!,
|
||||||
|
tgt: uid2State.get(tgtUID)!,
|
||||||
|
trigger: {
|
||||||
|
kind: "?",
|
||||||
|
},
|
||||||
|
guard: {},
|
||||||
|
actions: [],
|
||||||
|
};
|
||||||
|
const existingTransitions = transitions.get(srcUID) || [];
|
||||||
|
existingTransitions.push(transition);
|
||||||
|
transitions.set(srcUID, existingTransitions);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue