diff options
author | Jason Wray <jason@mapbox.com> | 2015-12-23 20:08:03 -0500 |
---|---|---|
committer | Jason Wray <jason@mapbox.com> | 2015-12-23 20:18:01 -0500 |
commit | 2aa1e5ca18cbff64501881ab6b799f2890b57b2b (patch) | |
tree | bd56dabd30470209a8ac2b4e327f683bf21b4535 | |
parent | 7a6076ea9df72f34565d8f316f8c5c19279677b8 (diff) | |
download | qtlocation-mapboxgl-2aa1e5ca18cbff64501881ab6b799f2890b57b2b.tar.gz |
[ios] vary annotation bounds fit padding based on view size
Fix #3392, #3110
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ab11b36ae..60769096de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Known issues: - A new method on MGLMapView, `-flyToCamera:withDuration:completionHandler:`, lets you transition between viewpoints along an arc as if by aircraft. ([#3171](https://github.com/mapbox/mapbox-gl-native/pull/3171), [#3301](https://github.com/mapbox/mapbox-gl-native/pull/3301)) - MGLMapCamera’s `altitude` values now match those of MKMapCamera. ([#3362](https://github.com/mapbox/mapbox-gl-native/pull/3362)) - The user dot’s callout view is now centered above the user dot. It was previously offset slightly to the left. ([#3261](https://github.com/mapbox/mapbox-gl-native/pull/3261)) +- Fixed an issue with small map views not properly fitting annotations within bounds. (#[3407](https://github.com/mapbox/mapbox-gl-native/pull/3407)) ## iOS 3.0.1 diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index f85816e44d..af3adae6b1 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2653,8 +2653,12 @@ std::chrono::steady_clock::duration MGLDurationInSeconds(float duration) } } + CGFloat defaultPadding = 100; + CGFloat yPadding = (self.frame.size.height / 2 <= defaultPadding) ? (self.frame.size.height / 5) : defaultPadding; + CGFloat xPadding = (self.frame.size.width / 2 <= defaultPadding) ? (self.frame.size.width / 5) : defaultPadding; + [self setVisibleCoordinateBounds:MGLCoordinateBoundsFromLatLngBounds(bounds) - edgePadding:UIEdgeInsetsMake(100, 100, 100, 100) + edgePadding:UIEdgeInsetsMake(yPadding, xPadding, yPadding, xPadding) animated:animated]; } |