summaryrefslogtreecommitdiff
path: root/platform/macos/src/MGLMapView.mm
diff options
context:
space:
mode:
authorBobby Sudekum <bobby@mapbox.com>2018-07-02 16:30:18 -0700
committerGitHub <noreply@github.com>2018-07-02 16:30:18 -0700
commit4286d5869c9af0513298b8b31d36744a3243bff4 (patch)
tree8db8172a0bc9320fb79d9060bddede7cca7ee1b3 /platform/macos/src/MGLMapView.mm
parent29e25356e355d466a60297117f3e7c010825a7ff (diff)
downloadqtlocation-mapboxgl-4286d5869c9af0513298b8b31d36744a3243bff4.tar.gz
Add pitch argument to cameraThatFits functions (#12213)
Diffstat (limited to 'platform/macos/src/MGLMapView.mm')
-rw-r--r--platform/macos/src/MGLMapView.mm26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index bc9ac1e641..154b716377 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -1275,6 +1275,32 @@ public:
return [self cameraForCameraOptions:cameraOptions];
}
+- (MGLMapCamera *)camera:(MGLMapCamera *)camera fittingCoordinateBounds:(MGLCoordinateBounds)bounds edgePadding:(NSEdgeInsets)insets
+{
+ mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets);
+ padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets);
+
+ MGLMapCamera *currentCamera = self.camera;
+ CGFloat pitch = camera.pitch < 0 ? currentCamera.pitch : camera.pitch;
+ CLLocationDirection direction = camera.heading < 0 ? currentCamera.heading : camera.heading;
+
+ mbgl::CameraOptions cameraOptions = _mbglMap->cameraForLatLngBounds(MGLLatLngBoundsFromCoordinateBounds(bounds), padding, direction, pitch);
+ return [self cameraForCameraOptions:cameraOptions];
+}
+
+- (MGLMapCamera *)camera:(MGLMapCamera *)camera fittingShape:(MGLShape *)shape edgePadding:(NSEdgeInsets)insets {
+ mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets);
+ padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets);
+
+ MGLMapCamera *currentCamera = self.camera;
+ CGFloat pitch = camera.pitch < 0 ? currentCamera.pitch : camera.pitch;
+ CLLocationDirection direction = camera.heading < 0 ? currentCamera.heading : camera.heading;
+
+ mbgl::CameraOptions cameraOptions = _mbglMap->cameraForGeometry([shape geometryObject], padding, direction, pitch);
+
+ return [self cameraForCameraOptions: cameraOptions];
+}
+
- (MGLMapCamera *)cameraThatFitsShape:(MGLShape *)shape direction:(CLLocationDirection)direction edgePadding:(NSEdgeInsets)insets {
mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(insets);
padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInsets);