Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

MGLMapView.centerCoordinate inconsistent padding reset #604

Open
ayarmalovich opened this issue May 31, 2021 · 1 comment
Open

MGLMapView.centerCoordinate inconsistent padding reset #604

ayarmalovich opened this issue May 31, 2021 · 1 comment

Comments

@ayarmalovich
Copy link

MGLMapView interface contains a method

func setCamera(MGLMapCamera, withDuration: TimeInterval, animationTimingFunction: CAMediaTimingFunction?, edgePadding: UIEdgeInsets, completionHandler: (() -> Void)?)

that takes edgePadding as an argument and applying it, it adjusts centerCoordinate of the map (on the video centerCoordinate is marked as green square). But there is inconsistency how user interaction (and programmatic camera updates) resets this adjustment. As you can see on the video pan gesture doesn't reset adjustment but pinch gesture do.
Also there is no way to check if current centerCoordinate is actually adjusted or not.

Steps to reproduce

  1. Setup camera
  2. call (on the video called on "setWithPadding" tap)
let edgePadding = UIEdgeInsets(top: 0, left: 0, bottom: 250, right: 0)
mapView.setCamera(newCamera, withDuration: 0.5, animationTimingFunction: nil, edgePadding: edgePadding)
  1. observe mapView.centerCoordinate (green square on the video, added as MGLPointAnnotation and position is updated in delegate regionDidChange method) it's adjusted according to passed edgePadding from step 2.
  2. move map with pan gesture, observe that mapView.centerCoordinate remains adjusted
  3. zoom map with pinch gesture, observe that mapView.centerCoordinate resets to the map center

Expected behavior

I'd expect consistent behavior, either reset adjustment after any map interaction or remain of adjustment after any map interaction(but it's not clear how to reset it then)

Actual behavior

mapView.centerCoordinate adjustment is reset by zoom gesture and not reset by pan gesture

Configuration

Mapbox SDK versions: 6.3.0, 5.6.1
iOS/macOS versions: 14.4
Device/simulator models: simulator iPhone 8
Xcode version: 12.4

@sbma44
Copy link
Member

sbma44 commented Jul 2, 2021

Thank you for bringing this issue to our attention and please excuse the delayed response. The Maps SDK team has been laser focused on our Maps SDK v10 RC release.

Good news: v10 supports the behavior you're looking for (gestures do not automatically reset padding). Unfortunately, after debating within our team we are unlikely to bring this capability to the legacy SDK. The primary reason for this is the possibility of breaking other customers' existing implementations. But it's also true that, although the legacy SDK will continue to receive critical bugfixes, we believe v10 is the future of our mobile offerings, and we must prioritize issues accordingly.

Please continue to share your needs with us, here or otherwise. We're eager to fix acute pain points and ensure that our future roadmap meets your requirements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants