Fix bug #461: Handles priorities are not working in some cases.

Place the comparison of the closest handle and the current handle outside the if block and modify the if block to use that comparison. It would prevent to do not take in consideration handles that are distant to the mouse position more than the closest handle found, but its distance is slightly bigger than the closest but significative small to be considered both at the same place.