Today I added this wonderful feature into FATester – right-click menu! Now you can right click a node to toggle initial and final states. Sadly, I spent most of the time debugging. There are three main things that I learned today to remember:
2. if an event is binded to an object for multiple times, the event will trigger the function as many times as the event is binded. This bothered me when I was trying to toggle initial and final states by clicking a button. If a state is toggle twice, then it is back to its original state!
3. offsets culumate. To make the right click menu appear, I am using a div and setting its position as absolute. However, I first used
offset() function to do this, which made the menu move further and further to right and bottom. After searching online, I decided to switch to jQuery function
.css() and changed the
top attributes, which work as a charm.
Some screenshots of this new function:
Before I developed this new function, users have to click Edit Node button and then click a node to change initial and final states.
Toggle initial state
Toggle final state
Having two initial states is not allowed
Besides this new function, I also added some exercises in the Linz book to the tester. There are now four problems and some test cases.