mapbox / mapbox-maps-ios

Interactive, thoroughly customizable maps for iOS powered by vector tiles and Metal
https://www.mapbox.com/mapbox-mobile-sdk
Other
485 stars 157 forks source link

carplay's street names blink on mapbox maps #2186

Open rahulpatracropsly opened 6 months ago

rahulpatracropsly commented 6 months ago

Environment

Observed behavior and steps to reproduce

carplay's street names blink continuously on carplay app

https://github.com/mapbox/mapbox-maps-ios/assets/113577007/c7d52b9a-9456-45a4-9499-61112701adab

Expected behavior

Expected behavior - it should not be blinking street names continuously

Notes / preliminary analysis

Additional links and references

evil159 commented 6 months ago

Hi @rahulpatracropsly, thank you for reporting this! Use [MapboxMap.beginAnimation()](https://docs.mapbox.com/ios/maps/api/11.4.0/documentation/mapboxmaps/mapboxmap/beginanimation()) to improve label placement during an animation, it should be balanced with [MapboxMap.endAnimation()](https://docs.mapbox.com/ios/maps/api/11.4.0/documentation/mapboxmaps/mapboxmap/endanimation()) after the animation ends.

evil159 commented 6 months ago

Could you post a code that you use for camera animation?

rahulpatracropsly commented 6 months ago

hi @evil159 thanks for replying! here is my code which i'm using for animate the camera

let newCamera = CameraOptions(center: coordinate,
                                                  padding: padding,
                                                  zoom: lastZoomLevel,
                                                  bearing: CLLocationDirection(floatLiteral: newHeading),
                                                  pitch: newPitch)
mapView.camera.fly(to: newCamera, duration: 1.0)
evil159 commented 6 months ago

Thank you for the code @rahulpatracropsly, if I understood your setup correctly, the issue is that you are performing a series of 1 second animations, you'd be better served with one continuous animation. If your goal is for camera to follow the location puck I can suggest using viewport API, namely FollowPuckViewportState.

rahulpatracropsly commented 2 months ago

Thank you @evil159 for your suggestion.

I tried implementing the FollowPuckViewportState as you recommended, but unfortunately, the camera animation is not smooth, and road names continue to blink while zooming in and out or moving the camera.

Here’s the code I’ve been using:

let updatedOptions = FollowPuckViewportStateOptions(
    padding: padding,
    zoom: lastZoomLevel,
    bearing: mapView.cameraState.bearing,
    pitch: 45.0
)
self.followPuckState = self.mapView.viewport.makeFollowPuckViewportState(options: updatedOptions)
mapView.viewport.transition(to: followPuckState)

I'm looking for smoother camera transitions without the road name blinking issue. Do you have any further recommendations to address this?

rahulpatracropsly commented 2 months ago

Hi @evil159, I'm still encountering the issue where road names blink or flicker during map navigation. I'm particularly looking for smoother camera transitions that prevent this road name blinking problem. Do you have any further recommendations or insights to help resolve this issue?

https://github.com/user-attachments/assets/6fcecd22-35ea-42db-9ac2-f479ec73854a

evil159 commented 2 months ago

Hi @rahulpatracropsly, sorry for the delayed response, yeah the symbols should not behave this way during animations, we can't reproduce the issue on our side, it would help us a great deal if you could provide a sample project demonstrating this issue.

rahulpatracropsly commented 1 month ago

Hi @evil159 Thank you for your suggestion! I tried several approaches to improve the frequent camera animations, and after adding a delay to the camera animation, the issue was resolved.