mapbox / mapbox/mapbox-maps-ios

Jerky Movement of ViewAnnotation

Open
#2,163 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
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.

  1. Add a ViewAnnotation on the map with an initial coordinate.
  2. Subscribe to the cameraChanged event.
  3. In the cameraChanged event, update the annotation's coordinate to the camera center.
  4. Drag the map quickly.
  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.