Skip to content

Instantly share code, notes, and snippets.

@subblue
Created January 9, 2015 12:04
Show Gist options
  • Save subblue/593da10d31213b956265 to your computer and use it in GitHub Desktop.
Save subblue/593da10d31213b956265 to your computer and use it in GitHub Desktop.
Scaling factor for HDPI canvas elements that also respects user defined page zoom
((window.devicePixelRatio || 1) * Math.max(window.outerWidth / window.innerWidth, 1)).toFixed(3) * 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment