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?
Asked
Active
Viewed 903 times
6

Derek 朕會功夫
- 92,235
- 44
- 185
- 247
-
If it did, that would suggest that the internal resolution of the viewport is higher than the number of pixels on the screen. I suppose it wouldn't be impossible, but it would be extremely unusual. – Niet the Dark Absol Oct 14 '16 at 17:49
-
Is there any factors including zooming that will affect this value? – Derek 朕會功夫 Oct 14 '16 at 17:55
1 Answers
4
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.

zett42
- 25,437
- 3
- 35
- 72