mapbox / mapbox/mapbox-maps-ios
Jerky Movement of ViewAnnotation
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 601
- Forks
- 196
- PR merge metrics
- No merged PRs in 30d
Description
Environment
- Xcode version: 15.2
- iOS version: 17.2
- Devices affected: all
- Maps SDK Version: 11.3.0
Observed behavior and steps to reproduce
When adding a ViewAnnotation to the map and updating its coordinates to the camera center upon camera changes, the annotation moves jerkily, especially noticeable when dragging the map quickly. This issue occurs in Maps SDK Version 11.3.0.
- Add a
ViewAnnotationon the map with an initial coordinate. - Subscribe to the
cameraChangedevent. - In the
cameraChangedevent, update the annotation's coordinate to the camera center. - Drag the map quickly.
- Observe that the annotation's movement is jerky.
let annotation = ViewAnnotation(
coordinate: .init(latitude: 40.7128, longitude: -74.0060),
view: SimplePointerView()
)
mapView.viewAnnotations.add(annotation)
mapView.mapboxMap.onCameraChanged
.observe { cameraChange in
annotation.annotatedFeature.geometry = .point(.init(cameraChange.cameraState.center))
}
.store(in: &cancellables)
Expected behavior
The annotation is expected to move smoothly across the map in response to camera changes, similar to the behavior observed in Maps SDK Version 10.17.0.
Notes / preliminary analysis
In our actual project, we're not just sticking the annotation's view to the camera's center. I'm doing this in the issue to demonstrate the problem in the simplest way. Actually, we're using our own calculated coordinates to update the annotations' positions and observing this stuttering movement. With this upgrade from v10 to v11 throwing us this curveball, we're kind of thinking about ditching moving annotations through Mapbox and maybe just sticking UIViews on top of the mapView instead. Not exactly thrilled about having to possibly go this route because of the update. It’s extra work we weren’t planning on.
Additional links and references
Video demonstrating jerky movement in v11.3.0: Link to video
Video showing smooth movement in v10.17.0: Link to video
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ViewAnnotation and mapView.mapboxMap.onCameraChanged usage shown in the reproduction, then compare annotation movement between Maps SDK 11.3.0 and 10.17.0 while dragging quickly. Confirm the camera-center and independently calculated-coordinate cases, and consider the issue done when ViewAnnotation movement is smooth during camera changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ios, swift
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100