Skip to content

Commit 6c9ae19

Browse files
committed
added stopping of Highlighted Null Transitions when clicked again
1 parent d191e99 commit 6c9ae19

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/components/Editor.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import TestAString from "../features/TestAString";
3838
import { TestAStringProps } from "../features/props/TestAStringProps";
3939
import { IsDFA } from "../utils/IsDFA";
4040
import { IsNFA } from "../utils/IsNFA";
41-
import { transitionSelectedColor } from "../consts/Colors";
41+
import { transitionColor, transitionSelectedColor } from "../consts/Colors";
4242
import {
4343
StateDefaultSize,
4444
StateMaxSize,
@@ -157,6 +157,9 @@ export const Editor = () => {
157157
stateY: 0,
158158
});
159159

160+
const [areTransitionsBeingHighlighted, setAreTransitionsBeingHighlighted] =
161+
useState(false);
162+
160163
const handleAddRow = (row: RowModel) => {
161164
if (states.length >= MaxNumberOfStates) {
162165
setAlertMessage(`Maximum ${MaxNumberOfStates} states allowed.`);
@@ -546,16 +549,21 @@ export const Editor = () => {
546549
if (t.value.includes("^")) {
547550
return {
548551
...t,
549-
color: transitionSelectedColor,
550-
dashness: {
551-
animation: 1,
552-
},
552+
color: areTransitionsBeingHighlighted
553+
? transitionColor
554+
: transitionSelectedColor,
555+
dashness: areTransitionsBeingHighlighted
556+
? false
557+
: {
558+
animation: 1,
559+
},
553560
};
554561
}
555562
return t;
556563
})
557564
);
558565

566+
setAreTransitionsBeingHighlighted((v) => !v);
559567
setToolSelected(null);
560568
};
561569

0 commit comments

Comments
 (0)