Fix mouse position calculation