question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

retina not acurate

See original GitHub issue

How to reproduce

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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
JLuccommented, Jun 22, 2018

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

0reactions
ghybscommented, Jun 22, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found