Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can devicePixelRatio be less than 1

For some reason any value of pixel ratio less than 1 does not work in my rendering algorithm. A value of zero does not make sense, however 0.5 does. Is it possible that devicePixelRatio return a value between 0 and 1?

like image 444
Derek 朕會功夫 Avatar asked Oct 14 '16 17:10

Derek 朕會功夫


1 Answers

DPR can be less than 1, if you set browser zoom to less than 100%. For a zoom factor of 50%, DPR would be 0.5.

Adjust browser zoom to below 100% and run this snippet, it will log the DPR:

console.log("devicePixelRatio:", window.devicePixelRatio);

Testing with Firefox I got min. DPR of ~0.34, with Chrome I got it down to 0.25.

like image 156
zett42 Avatar answered Oct 23 '22 05:10

zett42