Avoid division by 0; use vectors to check triangle

Probably obligated to send you this now that you've mentioned it and me on your blog. Feel free to prefer your slope method, though this doesn't divide by 0 when you're moving your mouse vertically and compare NaN against NaN.

Test Plan:
Moused up and down and diagonally on the KA learn menu locally with these changes.