I found a couple of very old issues that are basically the same as this one, but they are all d7 issues and about much older version of the leaflet library.

So I can't really see this one as a duplicate.

Here goes:

Am running leaflet 8.x-1.x-dev version with leaflet library 1.0.3

* When I create a map with leaflet views, using a geofield to list nodes, all is well when I have multiple nodes on the map.
* However when I filter down the results until I have only one marker on the map, the map is greyed out:
greyedout

* I need to zoom out one level to see the map with the one marker:
zoomedout

Anyone else encountered this?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

stijndmd created an issue. See original summary.

benjamin.merkley’s picture

Im experiencing a similar issue

Jarnetb’s picture

I've found out when exactly this issue appears.

When you've only got 1 marker on the map, the zoom on the map will be at the deepest level. This makes the map grey out on retina screens.
I suggest 2 "workarounds".

  • Use a different map style with leaflet_more_maps
  • Disable retina support for the map you are using. In the leaflet_more_maps.module you can find a function for each map type. Set dectectRetina to false for the correct map type. This is a rather dirty solution, but it beats a greyed out map!
strozx’s picture

FileSize
2.58 KB

Hello, I have written a patch. Basically the problem was that when the properties for the map were being filled the condition made it so that it always took values from $options variable but the actual value for the specific map was written in the $map variable. I also changed the minimum value to 0 for the allowed zoom, because some maps from leaflet_more_maps can have 0.

Regards Strozx.

  • itamair committed a591ae7 on 8.x-1.x
    Issue #2916029 by strozx, stijndmd: Leaflet view with only 1 marker...
itamair’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.