stadiamaps / ferrostar

A FOSS navigation SDK built from the ground up for the future
https://stadiamaps.github.io/ferrostar/
Other
184 stars 24 forks source link

[iOS] need to tap "recenter" twice with CoreLocationProvider #274

Closed michaelkirk closed 1 month ago

michaelkirk commented 2 months ago

While navigating, when tapping the "recenter" button, the puck appears on the screen, but the camera is not centered on the current location - so the puck does not reflect your actual location.

Interestingly, if you move pan the map again, and hit recenter again, then the camera flys to the correct position. I'm not sure why it works the second time, but this pattern is 100% reproducible for me.

Seeing this in the wild, I also recall that eventually the camera will reposition itself (IIRC after several seconds).

I'm not sure if it's relevant, but I'm not moving when this happens, so it's possible that no location updates are fired. One random hunch is that maybe the camera is waiting for a location update before it updates? But that wouldn't explain why tapping the button a second time fixes the issue. 🤷‍♂️

https://github.com/user-attachments/assets/5d66be62-738e-48b1-92e9-8967d91db887

This is seemingly not an issue when using the SimulatedLocationProvider, only with the CoreLocationProvider

I've reproduced this in the simulator and on a physical device in my own app (https://github.com/michaelkirk/ios-maps/tree/mkirk/ferrostar) but the DemoApp in ferrostar isn't set up to do routing with the CoreLocationProvider, so I haven't reproduced it there.

edit: for completeness, I hacked in support for CoreLocationProvider support and captured the same behavior in the ferrostar demo

https://github.com/user-attachments/assets/7c5eb926-b695-4915-88c3-e39c8a9424ca

I'm going to look into fixing this myself, but wanted to open the issue in case anyone had any immediate insight.

ianthetechie commented 2 months ago

This is seemingly not an issue when using the SimulatedLocationProvider, only with the CoreLocationProvider

Yeah, that's pretty believable. I expect the issue is with update triggers. The SimulatedLocationProvider is extremely "clean" and hides a lot of "real-world" pathologies ;)