mapbox-maps-flutter
mapbox-maps-flutter copied to clipboard
Location puck is drawn below LineLayer
When I use:
mapboxMap?.location.updateSettings(
LocationComponentSettings(
pulsingEnabled: true,
showAccuracyRing: true,
puckBearing: PuckBearing.COURSE,
puckBearingEnabled: true,
),
);
And add a LineLayer:
await mapboxMap?.style.addLayer(
LineLayer(
id: 'line_layer',
sourceId: 'line',
lineColor: Colors.pinkAccent.value,
lineTrimOffset: [0.0, 1.0],
lineWidth: 5.0,
),
);
The result is that the puck is drawn below the line. I think the default should be that the puck is always on top. Is this a bug or am I missing a setting?
It turns out you first have to draw the line and then turn on the location puck. I leave this issue open since I am not sure if this is by design or a bug. I still think the puck should be on top by default.
Hi @basvdijk, I'm able to reproduce this on Android, on iOS the location indicator is on top. Filed a bug in the internal issue tracker - https://mapbox.atlassian.net/browse/MAPSAND-1587
@evil159 The screenshot was taken from iOS. Changing the order of first drawing the line and then turning on the puck sovled it. layerAbove
and layerBefore
had no effect since this is Android only.
Interesting, I can't seem to reproduce this on iOS, which version to you use?
@evil159 iOS 17.4.1 but it might also be related to a race condition with async operations.
Ah, sorry, I mean what version of the Mapbox Maps Flutter Plugin do you use?
Commit https://github.com/mapbox/mapbox-maps-flutter/commit/1daef17c48fd927db442a5d19f7aca06a1ffdc63
@evil159 I have the same issue for point annotations. The yellow dot is below the line.
I saw createPointAnnotationManager
has a below
constructor property but not an above
. It looks like all with this issue had to do in the order of all the things are added to the map.
Hello
@basvdijk did you found any solution or workaround?
@hussenIbrahim yes, the only solution I could find is to change the order things are drawn. So first the route, then the location puck.
draw location puck after creating your polyineAnnotationManager. this works for me.
bookingPolylineAnnotationManager = await mapBoxController!.annotations .createPolylineAnnotationManager(id: "tripPolyline"); mapBoxController!.location .updateSettings(mapbox.LocationComponentSettings());