Fix mouse position with scaling on HTML5, closes #1023