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

Get and set visibleCoordinateBounds calculated differently #14134

Closed
TimWatson opened this issue Mar 16, 2019 · 1 comment
Closed

Get and set visibleCoordinateBounds calculated differently #14134

TimWatson opened this issue Mar 16, 2019 · 1 comment
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS

Comments

@TimWatson
Copy link

TimWatson commented Mar 16, 2019

With contentInset set, if you tell the map to set the visible coordinate bounds to the current visible coordinate bounds the map moves since getting the visible coordinate bounds doesn't take into account the map content inset but setting it does

Get:

return [self convertRect:self.bounds toCoordinateBoundsFromView:self];

Set:

mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets);
padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInset);

Steps to reproduce

  1. Set mapView.contentInset = UIEdgeInsets(top: 50, left: 10, bottom: 100, right: 10)
  2. Call mapView.setVisibleCoordinateBounds(mapView.visibleCoordinateBounds)
  3. Map jumps to different region

Expected behavior

Get visible coordinate bounds would take into account content inset and the map would stay put

Corrected Get:
return [self convertRect:self.bounds.inset(by: self.contentInset) toCoordinateBoundsFromView:self];

Actual behavior

Map jumps to different region

Configuration

Mapbox SDK versions: ios-v4.9.0
iOS/macOS versions: iOS 12.1.4
Device/simulator models: iPhoneX
Xcode version: 10.1

@tobrun tobrun added the iOS Mapbox Maps SDK for iOS label Mar 18, 2019
@stale stale bot added the archived Archived because of inactivity label Sep 14, 2019
@stale
Copy link

stale bot commented Sep 14, 2019

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Sep 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

2 participants