trafficonese / leaflet.extras

Extra functionality for leaflet R package.
https://trafficonese.github.io/leaflet.extras/
GNU General Public License v3.0
211 stars 74 forks source link

How to remove blue circle from the map when search is done? #209

Closed Camil88 closed 4 months ago

Camil88 commented 3 years ago

Hello, I found a similar topic here on 'Issues' but in my opinion the problem is not solved yet. I try to hide blue circle which appears when address in found on a map. I'm using hideMarkerOnCollapse:

leaflet.extras::addSearchOSM(
   options = leaflet.extras::searchOptions(
    hideMarkerOnCollapse = TRUE)
)

And still see this on a map:

obraz

Seems this option doesn't work. How can programatically get rid of this blue circle?

Camil88 commented 2 years ago

Any update please?

Camil88 commented 2 years ago

I've found the answer to my own question. Hiding blue circle is possible and there are 2 ways of doing it. First, you need to use some CSS and catch circle class + one of the key attributes which distinguish blue circle from other map markers' attributes. Then hide it. I chose this one: [stroke="#3388ff"]. So finally we got this:

path.leaflet-interactive[stroke="#3388ff"] {
    display: none;
}

Other option is to use it leflet option. Basically, addSearchOSM(options = searchOptions(hideMarkerOnCollapse = TRUE)) which hides the marker works only with autoCollapse = TRUE. Then the search marker is not visible on a map at all:

leaflet.extras::addSearchOSM(
   options = leaflet.extras::searchOptions(
    autoCollapse = TRUE,
    hideMarkerOnCollapse = TRUE)
)