[ios] vary annotation bounds fit padding based on view size

Fix #3392, #3110
This commit is contained in:
Jason Wray
2015-12-23 20:08:03 -05:00
parent 7a6076ea9d
commit 2aa1e5ca18
2 changed files with 6 additions and 1 deletions

View File

@@ -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

View File

@@ -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];
}