mapbox / mapbox/mapbox-maps-ios
camera.fly with edge insets does not work as expected
Nobody has claimed this yet.
- 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
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
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