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

Commit

Permalink
Exclude top/bottom bars when fitting to bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
1ec5 committed Jun 24, 2015
1 parent 3c9dc60 commit 31d2918
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions platform/ios/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,14 @@ - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEd
// NOTE: does not disrupt tracking mode
CGFloat duration = animated ? MGLAnimationDuration : 0;

// Accommodate top and bottom bars.
UIViewController *viewController = self.viewControllerForLayoutGuides;
if (viewController)
{
insets.top += viewController.topLayoutGuide.length;
insets.bottom += viewController.bottomLayoutGuide.length;
}

mbgl::EdgeInsets mbglInsets = {insets.top, insets.left, insets.bottom, insets.right};
_mbglMap->fitBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), mbglInsets, secondsAsDuration(duration));

Expand Down

0 comments on commit 31d2918

Please sign in to comment.