Better boundary collision check.

Updated to use the ball diameter instead of values 60/120. Any particular reason for those specific values?

Also, modified to use `window.innerHeight` instead of `window.innerWidth` when comparing vertically.