summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2015-06-24 12:21:03 -0700
committerMinh Nguyễn <mxn@1ec5.org>2015-06-25 21:54:57 -0700
commit68e404c522d318ca87e5435a997a21a9604ad0e8 (patch)
treecdfa27548d06f17b6de31468a339534c886e459f /platform
parentc57799f26cf06995629cfdee55bdd4a94452b320 (diff)
downloadqtlocation-mapboxgl-68e404c522d318ca87e5435a997a21a9604ad0e8.tar.gz
Fit to bounds with padding
Each side of the bounding box is specified independently, allowing more flexibility than the offset + padding construct supported in mapbox/mapbox-gl-js’ Camera.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/MGLMapView.mm8
1 files changed, 7 insertions, 1 deletions
diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm
index b8fea9d8e8..8fdfa294aa 100644
--- a/platform/ios/MGLMapView.mm
+++ b/platform/ios/MGLMapView.mm
@@ -1463,10 +1463,16 @@ mbgl::LatLngBounds MGLLatLngBoundsFromCoordinateBounds(MGLCoordinateBounds coord
- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated
{
+ [self setVisibleCoordinateBounds:bounds edgePadding:UIEdgeInsetsZero animated:animated];
+}
+
+- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated
+{
// NOTE: does not disrupt tracking mode
CGFloat duration = animated ? MGLAnimationDuration : 0;
- _mbglMap->fitBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), secondsAsDuration(duration));
+ mbgl::EdgeInsets mbglInsets = {insets.top, insets.left, insets.bottom, insets.right};
+ _mbglMap->fitBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), mbglInsets, secondsAsDuration(duration));
[self unrotateIfNeededAnimated:animated];