Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify <Marker> z-index #286

Open
jaydenseric opened this issue Apr 15, 2020 · 2 comments
Open

Add ability to specify <Marker> z-index #286

jaydenseric opened this issue Apr 15, 2020 · 2 comments

Comments

@jaydenseric
Copy link

jaydenseric commented Apr 15, 2020

Is your feature request related to a problem? Please describe.

There appears to be no way to specify the z-index for <Marker>.

Generally, markers that are further south should layer on top to maintain the skeuomorphic pin effect. This type of layering is not automatic, so having the ability to specify marker z-index would be useful - otherwise we have to rely on sorting the marker point lists by latitude so they are looped at render in the right order.

Also, sometimes you want to be able to click a marker to have it expand and layer above all the others. For this use case, I can't think of an elegant solution. I've tried hiding the marker, and inserting a more detailed one after all the markers, which works at first render but after zooming in and out a few times the z-indexing of all the markers changes for some reason and the last marker in the JSX is no longer layered on top.

Describe the solution you'd like

Add a zIndex prop for the Marker component.

Describe alternatives you've considered

Add a styles prop on the Marker component. These styles would merge with and override the generated marker inline styles. This would allow customization of more styles that just z-index.

Additional context

Example layering issue when a marker is clicked and expanded:

Screen Shot 2020-04-15 at 4 24 49 pm

@cazzer
Copy link
Contributor

cazzer commented Jul 13, 2020

@jaydenseric I ran into the same problem before realizing that the Popup component can help with this problem; if I have content which should be open, I render it with that component after any other markers or clusters:

return (
  <MapGL>
    <Cluster ... />
    {selectedMarker && (
      <Popup ... />
    )}
  </MapGL>
)

@tonnoz
Copy link

tonnoz commented Apr 17, 2021

@cazzer thanks that solved my issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants