react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Show markers on top of marker clusterers

Open techie014 opened this issue 8 years ago • 3 comments

I have a single marker which I want to get rendered on top of everything. Setting z-index did not help me as I learned marker clusterers and markers get rendered in different layers. This is the current situation:

capture

As you see the person marker is covered by the clusterers. I found this link for a workaround: https://philipwalton.com/articles/what-no-one-told-you-about-z-index/

It says that setting a difference in opacity helps seeing specific objects in the front. But as I set opacity property of the marker, it isn't helping much.

Props:

{
  position: {
    lat: address.lat,
    lng: address.lon,
  },
  title: customTitle,
  defaultOptions: {
    optimized: false,
  },
  defaultOpacity: 1.00,
  opacity: 1.00,
  zIndex: customzIndex,
}

Any kind of help will be much appreciated.

techie014 avatar Dec 17 '17 15:12 techie014

I have the same problem too, it is anoying the cluster icons don't wont respect the z-indexes of non cluster icons. I will report here if i find a solution.

That link you found is not the solution you are looking for. It is an old solution for z-indexes in css. Google maps uese the same name for the same concept but is not the same thing.

erikhuisman avatar Dec 29 '17 10:12 erikhuisman

@erikhuisman Thanks for the response. Actually the technique in the given link worked for me. The process was:

  • Assign a large value as z-index for the markers.
  • Using css grab the element using that specific z-index.
  • Make opacity to 1.0

However, I guess most may agree with me that this is not a neat process. Kind of a workaround. So if there is a way to do it using library or something that I don't know of the library, it would be better.

techie014 avatar Jan 01 '18 17:01 techie014

Should be the underlying problem of MarkerClustererPlus. https://github.com/mikesaidani/marker-clusterer-plus

tomchentw avatar Jan 04 '18 14:01 tomchentw