soulwire / sketch.js

Cross-Platform JavaScript Creative Coding Framework
MIT License
4.09k stars 431 forks source link

Fix retina touch #75

Closed filR closed 8 years ago

filR commented 8 years ago

As far as I can tell, something in 9842135 broke the touch/mouse position when the retina option is on. On a 2x hires retina display, the mouse position is only 50% from where it should be (i.e. 50px instead of 100px).

Reproduce the problem here: http://codepen.io/anon/pen/meBKNL?editors=001 This codepen uses sketch.js from the master branch of this repository.

problem

Test the fix here: http://codepen.io/anon/pen/pjWZvo?editors=001 This is the fixed sketch.js from the pull request.

fix

Problem and fix tested on a Macbook Retina, Macbook non-Retina, and on Chrome with various "device pixel ratio" settings in the devtools.

soulwire commented 8 years ago

Good spot, thanks! :)

filR commented 8 years ago

Sure thing, glad I could help. Thanks for creating sketch.js!