retina not acurate
See original GitHub issueHow to reproduce
- Leaflet version I’m using: 1.3.1 but also on http://leaflet-extras.github.io/leaflet-providers/preview/
- Browser (with version) I’m using: Firefox 60.0.2 or Chromium 66.0.3359.181
- OS/Platform (with version) I’m using: Ubuntu 17.10
What behaviour I’m expecting and which behaviour I’m seeing
Documentation says “detectRetina : If true and user is on a retina display, it will request four tiles of half the specified size and a bigger zoom level in place of one to utilize the high resolution.”
But it’s not used to compute L.Browser.retina
(true for browsers on a high-resolution “retina” screen.)
var retina = (window.devicePixelRatio || (window.screen.deviceXDPI / window.screen.logicalXDPI)) > 1;
On my screen, window.devicePixelRatio
is 2 when browser display is zoomed to 200%
so L.Browser.retina
is true as soon as display zoom is > 100% and false when browser zoom is < 100%
That is not what “retina” is meant to be.
Minimal example reproducing the issue
- Open browser, zoom display to 150% (this is browser display, not map zoom)
- Browse to http://leaflet-extras.github.io/leaflet-providers/preview/
- Choose
Stamen toner
or another provider with retina tiles - Open developer 's javascript console
- See the value for L.Browser.retina
- See the value for window.devicePixelRatio
- Open “Network” tab and see the uploaded tiles : they are @2x version
- Unzoom browser (dont unzoom the map, but the browser display, using its menu)
- See values…
Window has to be refreshed CTRL+F5 after browser display zoom has changed; so retina value is computed anew
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Retinal problems: Types, symptoms, and treatments
Retinal detachment is a medical emergency that, without treatment, may lead to permanent vision loss. Retinopathy. Retinopathy results from ...
Read more >Retina Problems | Common Retinal Diseases
Common retinal conditions include floaters, macular degeneration, diabetic eye disease, retinal detachment, and retinitis pigmentosa. There are other issues ...
Read more >10 Critical Warning Signs of Retinal Damage
If it pulls up on the retina too much, it can distort your vision, and eventually cause damage. However, distorted vision may also...
Read more >Retinal diseases - Diagnosis and treatment - Mayo Clinic
This test is an excellent technique for capturing precise images of the retina to diagnose epiretinal membranes, macular holes and macular swelling (edema), ......
Read more >Retina Focus: How Do You Know if Treatment is Working?
Determining the effectiveness of treatment in a patient with suspected retinal pathology can be challenging. While visual acuity can serve as a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok I understand. You’re right about avoiding blurry images.
What now might be improved is the wording and the explanation : both “retina screen” and “high DPI” (dot per inch = screen property) are not fit to describe what L.Browser.retina realy is.
I propose https://github.com/Leaflet/Leaflet/pull/6203
The steps and result you describe are the expected behaviour.
Although the flag is called “retina”, it targets high DPI, and the case of a natively zoomed browser window is also considered in that category. Now this may be argued upon, but it seems to me that this is for a reason and it does not harm much in any case: why do you absolutely want not to load @2x tiles when your browser window is zoomed? That provides with crisper graphics, instead of blurry zoomed images.