From 7b931078695b6c69ceb6981f9034d7df1227a477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Fri, 4 Sep 2015 15:51:38 -0700 Subject: [PATCH] Corrected roundtripping altitude with rotation --- platform/ios/MGLMapView.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/ios/MGLMapView.mm b/platform/ios/MGLMapView.mm index ef6ae52c33f..e509b5c8d84 100644 --- a/platform/ios/MGLMapView.mm +++ b/platform/ios/MGLMapView.mm @@ -1825,7 +1825,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a double angle = -1; if (camera.heading >= 0) { - angle = MGLRadiansFromDegrees(mbgl::util::wrap(-camera.heading, 0., 360.)); + angle = MGLRadiansFromDegrees(-camera.heading); } double pitch = -1; if (camera.pitch >= 0) @@ -1851,12 +1851,12 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a else // portrait { sw = _mbglMap->latLngForProjectedMeters({ - centerMeters.northing - centerToEdge * std::cos(angle) + centerToEdge * std::cos(angle) * std::sin(pitch) / 2, - centerMeters.easting - centerToEdge * std::sin(angle) + centerToEdge * std::sin(angle) * std::sin(pitch) / 2, + centerMeters.northing - centerToEdge * std::cos(-angle) + centerToEdge * std::cos(-angle) * std::sin(pitch) / 2, + centerMeters.easting - centerToEdge * std::sin(-angle) + centerToEdge * std::sin(-angle) * std::sin(pitch) / 2, }); ne = _mbglMap->latLngForProjectedMeters({ - centerMeters.northing + centerToEdge * std::cos(angle) - centerToEdge * std::cos(angle) * std::sin(pitch) / 2, - centerMeters.easting + centerToEdge * std::sin(angle) - centerToEdge * std::sin(angle) * std::sin(pitch) / 2, + centerMeters.northing + centerToEdge * std::cos(-angle) - centerToEdge * std::cos(-angle) * std::sin(pitch) / 2, + centerMeters.easting + centerToEdge * std::sin(-angle) - centerToEdge * std::sin(-angle) * std::sin(pitch) / 2, }); } @@ -1865,7 +1865,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a mbgl::CameraOptions options = _mbglMap->cameraForLatLngs({ sw, ne }, {}); options.center = centerLatLng; - if (angle >= 0) + if (camera.heading >= 0) { options.angle = angle; }