Removing or recoloring an elementTopA fancier drawing programFinding an item in an array

Finding an item in an array

The most interesting code in the program is the one to determine if the point clicked is inside any of the objects. See getIndexOf. Notice that if point is in several elements, selected will only refer to the last of these.

Having this method makes it easy to change the color of an item on the screen and relatively easy to delete one. In that case, one must move the other elements in the array down to fill the gap.


Removing or recoloring an elementTopA fancier drawing programFinding an item in an array