Skip to content

Instantly share code, notes, and snippets.

@auchenberg
Created April 8, 2018 21:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save auchenberg/9eae2e61ba01e0ea8747c8268ed5c8fd to your computer and use it in GitHub Desktop.
Save auchenberg/9eae2e61ba01e0ea8747c8268ed5c8fd to your computer and use it in GitHub Desktop.
window.onwheel = function (e) {
e.preventDefault();
if (e.ctrlKey) {
// Your zoom/scale factor
scale -= e.deltaY * 0.01;
} else {
// Your trackpad X and Y positions
posX -= e.deltaX * 2;
posY -= e.deltaY * 2;
}
render();
};
@VadimGush
Copy link

Nice, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment