mapbox / mapbox/mapbox-maps-ios

camera.fly with edge insets does not work as expected

Open
#990 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: p3
Dominant language
Swift
Stars
601
Forks
196
PR merge metrics
No merged PRs in 30d

Description

Environment

  • Xcode version: 13.2.1
  • iOS version: all, but simulator iOS 15.2 exhibits it
  • Devices affected: ipad
  • Maps SDK Version: 10.2.0

Observed behavior and steps to reproduce

If you try to fly to a location or geometry with a top edge inset that is sufficiently larger than the bottom edge inset, then the animation will jerk at the end and the map will have a weird margin at the top of the view.

This code added to the viewDidLoad() method in the BasicMapExample will show the bug:

mapView.mapboxMap.onEvery(.mapLoaded) { _ in
	let options = CameraOptions(center: .init(latitude: 40, longitude: 40), padding: .init(top: 250, left: 30, bottom: 50, right: 33))
	self.mapView.camera.fly(to: options, duration: 1 )
}

Expected behavior

The map should fly to the position smoothly and not have a strange margin at the top.
If you change the top edge inset to 50 then it will work as expected.

Notes / preliminary analysis

No idea why this doesn't work but it interferes with the padding that we would like to apply to our application.

Additional links and references

https://user-images.githubusercontent.com/8593979/148146674-2c645551-bcf2-4107-9920-fb15cb3b4edf.mov

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

Reproduce the issue by adding the provided camera.fly call to viewDidLoad() in the BasicMapExample, using the supplied padding values. Trace the camera.fly handling from that entry point and compare it with the working 50-point top inset case; done means the animation is smooth and no unexpected top margin remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile-dev
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.