my theory is that : you change state in this if clause.
Therefore when we reach the other
if clause state is already changed and therefore
the 2nd condition is also true.
(our idea was that state would stop the 2nd if from executing but this won’t work now (it’s because how your code is, never mind))
The return
command immediately leaves the whole mousePressed function the hard way, so the 2nd if-clause can’t be reached. It will be reached next time you click the mouse though.