|
8 | 8 | saveFSMAtom, |
9 | 9 | recentStateSave, |
10 | 10 | start_state, |
| 11 | +alert |
11 | 12 | }from"../lib/backend"; |
12 | 13 | import{useAtom,useAtomValue,useSetAtom}from"jotai"; |
13 | 14 | import{Nodes}from"../lib/backend"; |
@@ -46,6 +47,8 @@ const Editor = () => { |
46 | 47 |
|
47 | 48 | const[startState,setStartState]=useAtom(start_state); |
48 | 49 |
|
| 50 | +constsetAlertMsg=useSetAtom(alert); |
| 51 | + |
49 | 52 | // Every time a state's controls are changed(size), it's transition arrows should also be updated |
50 | 53 | useEffect(()=>{ |
51 | 54 | if(recentStateControlSaved=="nil")return; |
@@ -177,6 +180,8 @@ const Editor = () => { |
177 | 180 | for(consttrofnodeList[transitionTracker].transitions){ |
178 | 181 | if(tr.to!=null&&tr.to==id){ |
179 | 182 | setTransitionTracker(undefined); |
| 183 | +setAlertMsg("This transition already exists!"); |
| 184 | +setTimeout(()=>setAlertMsg("nil"),3000); |
180 | 185 | return; |
181 | 186 | } |
182 | 187 | } |
@@ -521,7 +526,7 @@ const Editor = () => { |
521 | 526 | // Update location of text |
522 | 527 | trText.x( |
523 | 528 | transitions[trNameEditor[2]].points[2]- |
524 | | -3*trNameEditor[1].length |
| 529 | +3*trNameEditor[1].length |
525 | 530 | ); |
526 | 531 | trText.y(transitions[trNameEditor[2]].points[3]-20); |
527 | 532 |
|
|