diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-06-24 12:21:03 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-06-25 21:54:57 -0700 |
commit | 68e404c522d318ca87e5435a997a21a9604ad0e8 (patch) | |
tree | cdfa27548d06f17b6de31468a339534c886e459f /include | |
parent | c57799f26cf06995629cfdee55bdd4a94452b320 (diff) | |
download | qtlocation-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 'include')
-rw-r--r-- | include/mbgl/ios/MGLMapView.h | 6 | ||||
-rw-r--r-- | include/mbgl/map/map.hpp | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/mbgl/ios/MGLMapView.h b/include/mbgl/ios/MGLMapView.h index 001e7aa678..bf42f47e7f 100644 --- a/include/mbgl/ios/MGLMapView.h +++ b/include/mbgl/ios/MGLMapView.h @@ -126,6 +126,12 @@ IB_DESIGNABLE * @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. */ - (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds animated:(BOOL)animated; +/** Changes the receiver’s viewport to fit the given coordinate bounds, optionally animating the change. +* @param bounds The bounds that the viewport will show in its entirety. +* @param insets The minimum padding (in screen points) that will be visible around the given coordinate bounds. +* @param animated Specify `YES` to animate the change by smoothly scrolling and zooming or `NO` to immediately display the given bounds. */ +- (void)setVisibleCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(UIEdgeInsets)insets animated:(BOOL)animated; + /** The heading of the map (measured in degrees) relative to true north. * * The value `0` means that the top edge of the map view corresponds to true north. The value `90` means the top of the map is pointing due east. The value `180` means the top of the map points due south, and so on. */ diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 42ae72bb70..463235915e 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -38,6 +38,10 @@ using AnnotationIDs = std::vector<uint32_t>; using AnnotationSegment = std::vector<LatLng>; using AnnotationSegments = std::vector<AnnotationSegment>; +using EdgeInsets = struct { + double top, left, bottom, right; +}; + class Map : private util::noncopyable { friend class View; @@ -95,7 +99,7 @@ public: void setZoom(double zoom, Duration = Duration::zero()); double getZoom() const; void setLatLngZoom(LatLng latLng, double zoom, Duration = Duration::zero()); - void fitBounds(LatLngBounds bounds, Duration = Duration::zero()); + void fitBounds(LatLngBounds bounds, EdgeInsets padding, Duration duration = Duration::zero()); void resetZoom(); double getMinZoom() const; double getMaxZoom() const; |