-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Platforms
web
Version of flutter maplibre_gl
0.24.1
Bug Description
It is not possible to add a symbol using the SymbolManager and have this symbol be displayed on top of other layers that have been previously added. This seems odd and counter intuitive.
maplibre.MapLibreMap(
onMapCreated: (maplibre.MapLibreMapController controller) {
// For some reason, when I add my source and layers here, they are not displayed,
// so I am adding them in onStyleLoadedCallback instead.
},
onStyleLoadedCallback: () async {
// Add a source and layers using this source here (making sure everything is awaited)
// This works fine.
// Register icon '_markerIconName' (again, awaited)
// Add a symbol
final symbol = maplibre.Symbol(
symbolId,
buildSymbolOptions(
geometry: maplibre.LatLng(ll.latitude, ll.longitude),
iconImage: _markerIconName,
iconSize: 1.2,
zIndex: 1000));
await _mapsController!.symbolManager!.add(symbol);
// At this point, the symbol is successfully displayed, but behind the layers added further up in this code block
}This works fine, but the added symbol is always displayed behind the added layers.
Is there a way to have this symbol displayed above everything else? Do I need to add a custom layer or is there a way to somehow "delay" the creation of the SymbolManager ?
Steps to Reproduce
Use above code.
Expected Results
Defining a symbol using the SymbolManager should make it possible to display this symbol above everything else. This scenario is quite common, I believe, and - maybe I am mistaken - I expected the SymbolManager to be a handy way to quickly add a symbol, again, typically above all other layers. Handy way = without going through the effort of adding a custom layer with eg., just one symbol in this layer.
Actual Results
The SymbolManager (and probably associated internal layer) is always displayed behind previously-added layers.
The API (at least the web api) does not provide a way to set the z-index of the SymbolManager layer, as far as I can tell.
Code Sample
See above.