Handle window scrolling when cursor goes beyond the visible viewport