The main modification I made is the code in yellow. The other change is that the line that calls the show method of the Tooltip is moved inside the if statement.
Check the implementation in the attached project and let me know if you have any questions about it.