Open JuLink opened 7 months ago
Thanks for the super detailed bug report!
I hope with some more eyes we can find a fix for this.
@louwers I tried to remove all the animation of the MLNMapView by setting the MLNAnimationDuration
and MLNUserLocationAnimationDuration
to 0. The result looks like this (note this is much more zoomed than the previous videos) :
https://github.com/maplibre/maplibre-native/assets/1457215/f266d0fe-4c32-4d99-8e3e-abf11348d504
A bad quality gif to avoid looking at the video :
I think this is the expected result minus the animation between location update. This leads me to think that this issue is map animations cancelling each others out.
MLNMapView._setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:
method to center the map to the new location of the user. MLNMapView._setDirection:animated:
to rotate the map at the proper orientation.MLNMapView.cancelTransitions
which in turn calls the mbglMap.cancelTransitions()
.Since the heading is updated more frequently than the location, the main animation that can complete without being stop by the other is the rotation one (or at least if its cancelled, the next iteration is so quick to be called that this animation seems to not have been stopped).
It's quite difficult to understand all the code and the implication of a modification. And all my attempts were failure 😅
Do you have any idea how I can try to fix this issue ?
Describe the bug Setting the userTrackingMode of the MapView to MLNUserTrackingModeFollowWithHeading leads to bumpy update of the MLNUserLocationAnnotationView.
To Reproduce Steps to reproduce the behavior:
MLNUserTrackingModeFollowWithHeading
by clicking on the top right navigation bar item (until it represent an arrow with a line in front of it).Expected behavior The update to the
MLNUserLocationAnnotationView
should be smooth exactly like when you use theMLNUserTrackingModeFollow
userTrackingMode.Screenshots In the video you can see the difference of update between the
MLNUserTrackingModeFollow
and theMLNUserTrackingModeFollowWithHeading
update to the user annotation. In the first part of the video, I'm using the Follow mode and in the second part I'm using the FollowWithHeading. You can see that in the second part of the video the update is not as good as in the first part. https://github.com/maplibre/maplibre-native/assets/1457215/d2ec55ad-9679-44ae-9fcd-3d520ba497d7As you can see in the second case, the rotation of the map is smooth but the update to the location is not.
Platform information (please complete the following information):
Additional context By doing a few tests I came to the conclusion that the issue is some kind of animation issues between the annotation of the user and the rotation of the map. I suspect that when walking with the phone out, the heading goes all over the place and therefore leads to rotating the map very frequently and it conflict with the animation of centering the annotation on the correct coordinates. By commenting the line
6398
of theMLNMapView.mm
which is the the[self _setDirection:headingDirection animated:YES];
of the methodMLNMapView.locationManager:didUpdateHeading:
the update of the user location is smooth again (of course the map doesn't turn anymore). I tried to fix the issue but can't figure it out 😥