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

Circles appear behind other layers #50

Closed
ryanhamley opened this issue Oct 10, 2017 · 2 comments
Closed

Circles appear behind other layers #50

ryanhamley opened this issue Oct 10, 2017 · 2 comments

Comments

@ryanhamley
Copy link
Contributor

ryanhamley commented Oct 10, 2017

Hi, I started implementing mapbox-gl-circle into a program that has several other layers on the map and noticed that the circle always appeared behind one of my other layers, regardless of what order they were added in.

I tracked it down to these lines in the code where waterway-label is hardcoded as the second argument to addLayer causing the circle to always be added just before this layer.

You can see the issue in action here:
screen shot 2017-10-10 at 11 20 58 am

It's pretty straightforward to expose the before argument to the user so that users can control where a circle is added in the layer stack. I implemented a fix as you can see in this image.

screen shot 2017-10-10 at 11 16 46 am

Here's my pull request for the proposed fix https://github.com/mblomdahl/mapbox-gl-circle/pull/51

Thanks!

mblomdahl added a commit that referenced this issue Oct 21, 2017
ghost pushed a commit that referenced this issue Oct 21, 2017
mblomdahl added a commit that referenced this issue Oct 22, 2017
@mblomdahl
Copy link
Member

mblomdahl commented Oct 22, 2017

@ryanhamley I noticed a bug with this implementation;

screen shot 2017-10-22 at 4 49 52 pm

Notice that the handle in the center is now getting blurred by overlapping circles. Handles must always be at the top, so I modified the code in 09a19f4 to use 'waterway-label' by default for fill/stroke, but still allows you to force the layers to end of layers array by doing myCircle.addTo(myMap, null). Released to NPM with #54.

@ryanhamley
Copy link
Contributor Author

Thanks for the couple of corrections and additional info on this @mblomdahl Sorry to be MIA for it as I was on vacation the past week. I'm going to try this out in my app now.

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

No branches or pull requests

2 participants