mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Location puck is drawn below LineLayer

Open basvdijk opened this issue 9 months ago • 11 comments

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? image

basvdijk avatar Apr 28 '24 07:04 basvdijk

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.

basvdijk avatar Apr 30 '24 09:04 basvdijk

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 avatar Apr 30 '24 11:04 evil159

@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.

basvdijk avatar Apr 30 '24 11:04 basvdijk

Interesting, I can't seem to reproduce this on iOS, which version to you use?

evil159 avatar Apr 30 '24 11:04 evil159

@evil159 iOS 17.4.1 but it might also be related to a race condition with async operations.

basvdijk avatar Apr 30 '24 11:04 basvdijk

Ah, sorry, I mean what version of the Mapbox Maps Flutter Plugin do you use?

evil159 avatar Apr 30 '24 12:04 evil159

Commit https://github.com/mapbox/mapbox-maps-flutter/commit/1daef17c48fd927db442a5d19f7aca06a1ffdc63

basvdijk avatar Apr 30 '24 13:04 basvdijk

@evil159 I have the same issue for point annotations. The yellow dot is below the line. image

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.

basvdijk avatar May 08 '24 15:05 basvdijk

Hello

@basvdijk did you found any solution or workaround?

hussenIbrahim avatar Jun 02 '24 18:06 hussenIbrahim

@hussenIbrahim yes, the only solution I could find is to change the order things are drawn. So first the route, then the location puck.

basvdijk avatar Jun 02 '24 20:06 basvdijk

draw location puck after creating your polyineAnnotationManager. this works for me. bookingPolylineAnnotationManager = await mapBoxController!.annotations .createPolylineAnnotationManager(id: "tripPolyline"); mapBoxController!.location .updateSettings(mapbox.LocationComponentSettings());

SuHlaHlaPhyu avatar Jul 23 '24 09:07 SuHlaHlaPhyu