maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.06k stars 310 forks source link

Android: Location puck switch icon on rotating camera #2879

Open Fabi755 opened 1 month ago

Fabi755 commented 1 month ago

Describe the bug We have a really strange behavior of the location icon. And I am at the end of my ideas.

I'm currently working on upgrading the MapLibre navigation to v11. After upgrade (from v11.0.2-pre0) to v11.1.0 (and above) the location puck gets flickering by rotating. After more research we found out that the icon goes to the maplibre_user_stroke_icon drawable. The puck is going back to the right drawable, when zoom in/out, or update the location.

The maplibre_user_stroke_icon is used by two styles (maplibre_backgroundDrawable & maplibre_backgroundDrawableStale). Changing the styles has no effect to displayed icon in my tests.

I can't see this issue on the sample app (build from source). But I see this issue also in a new project from scratch. I can't see this issue on my Emulator running on a Mac.

To Reproduce

Steps to reproduce the behavior:

  1. Clone my sample repository
  2. Run app on a real device
  3. Allow using location, to make things work
  4. Rotate map
  5. Puck is flickering between GPS puck and red dot (maplibre_user_stroke_icon)

(Use the enable/disable) button to see the stroke-icon state, without location updates. If disabled, only zoom in/out goes back to the GPS puck.

Expected behavior Icon should not changed to the stroke icon, and the GPS puck should always showed.

Screenshots

https://github.com/user-attachments/assets/0c5f889e-e8fd-4f68-87b1-6079ec1fb8b3

Platform information (please complete the following information):

Additional context

alasram commented 1 week ago

I'm having the exact same problem but it's only reported in 11.5. (11.1 seems to not have this issue)

alasram commented 1 week ago

The VAO of the Drawable is changing which means we're running vertex input commands outside the drawable that are affecting the bound VAO. A solution is to unbind the VAO after drawing but a correct solution would ensure we never run commands that affect VAO outside a Drawable object. This code works for me: https://github.com/alasram/maplibre-native-experimental/commit/473fdfa784f73e337c9b7edee93bc95eb3815237

louwers commented 1 week ago

@alasram Could you make a PR?