strues / retinajs

JavaScript, SCSS, Sass, Less, and Stylus helpers for rendering high-resolution image variants
http://retinajs.com
MIT License
4.42k stars 610 forks source link

devicePixelRatio rounding #274

Closed jaykay-design closed 3 years ago

jaykay-design commented 7 years ago

I got some strange device pixel ratios like 2.0000000298023224

I fixed it with changing line 24 to:

var environment = hasWindow ? Math.round(window.devicePixelRatio * 10) / 10 || 1 : 1;