Maps: zIndex support

Created on 19 Sep 2019  路  5Comments  路  Source: react-native-mapbox-gl/maps

Is there a way to force a specific layer to always be on top ?

Most helpful comment

I wonder if layerIndex could serve this purpose? The problem right now, as far as I can tell, is that if you specify a layer index that's larger than the amount of layers on the map, you get an index out of bounds crash. Could we change that so that if you put a layer index of 9999, it would insert the layer at the end of the array?

All 5 comments

I'm looking for this feature too. It would be great

You can use belowLayerId and aboveLayerId to specify the order. Is this what you are looking for?

The problem with belowLayerId and aboveLayerId is that if there are, let's say, a bunch of layers that we want to be displayed above a bunch of other layers, it'll become a mess pretty rapidly, no ?

With a zIndex like, we could set zIndex to 1000 for one of the group and 10 for the second one without any issue.

While I understand the use case, I don't think there is any kind of concept of zIndex in the style spec. Support for this would mean:

1) A request to Mapbox for updating the style spec
2) Wait for Mapbox to implement zIndex for iOS and Android SDKs
3) Expose zIndex in the react native wrapper

If you manage to get the ball rolling on this (file a ticket at the native SDK repo), we're happy to support this on the RN side if it makes it into the native side. If this happens, open an issue here and we'll make sure it gets added.

I wonder if layerIndex could serve this purpose? The problem right now, as far as I can tell, is that if you specify a layer index that's larger than the amount of layers on the map, you get an index out of bounds crash. Could we change that so that if you put a layer index of 9999, it would insert the layer at the end of the array?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexisrougnant picture alexisrougnant  路  3Comments

fvieira picture fvieira  路  4Comments

MariaSyed picture MariaSyed  路  4Comments

arnaudambro picture arnaudambro  路  5Comments

andrei-tofan picture andrei-tofan  路  5Comments