soulwire / sketch.js

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

Scaling retina coordinates for all callbacks #77

Open filR opened 8 years ago

filR commented 8 years ago

Before this pull request, when in "retina land", only the draw callback and no other had its coordinate system scaled. This means that coordinates were inconsistent between draw and sketch.mouse on the one hand and all other callbacks (such as update and touchmove) on the other.

In this pull request I moved the execution of update to also be affected by the draw scaling. Furthermore I added a scaling wrapper around all other callbacks. I also removed my previous pull request which "fixes" the mouse retina coordinates for all "other" callbacks, but inconveniently breaks it for draw.

All changes affect only retina: true scenes. Please let me know if you had another solution in mind or anything is unclear, I am happy to adjust this pull request to whatever fits the project. Thanks!