asascience / ott-coops

Project Tracking for OTT Co-Ops
1 stars 0 forks source link

Custom Layer Tool Draws Underneath Loading Layers #422

Closed jamesdoyle21 closed 2 years ago

jamesdoyle21 commented 2 years ago

The easiest way to solve this is probably to only allow the user to start drawing after all layers have loaded in.

image

kvmartin001 commented 2 years ago

It might actually be easier to add the editing layer(s) to the sorting config.

@ndellicarpini if I have a bunch of map sources that all start with a certain string, can we configure them to always be on top?

The drawing plugin adds like 30 sources to the map, one for each type of geometry it needs x2 for blue and orange

jamesdoyle21 commented 2 years ago

This is actually happening to me after layers are loaded in now. But I'm not positive what the steps are to reproduce

image

ndellicarpini commented 2 years ago

I don't think we can use the layer sorting for the active editing layer because they aren't added to the map like our other layers, they are kind of sneakily added to the map layers. I think you're going to have to move the layers yourself, ignoring any layer sorting.

When the layers get added, find all of those layers with that string and use this: https://docs.mapbox.com/mapbox-gl-js/api/map/#map#movelayer