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?
-
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 AbsolOct 14, 2016 at 17:49
-
Is there any factors including zooming that will affect this value?– Derek 朕會功夫Oct 14, 2016 at 17:55
Add a comment
|
1 Answer
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.