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

Commit c11a45d

Browse files
committed
Corrected roundtripping altitude with rotation
1 parent 02cc15f commit c11a45d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

platform/ios/MGLMapView.mm

+6-6
Original file line numberDiff line numberDiff line change
@@ -1825,7 +1825,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
18251825
double angle = -1;
18261826
if (camera.heading >= 0)
18271827
{
1828-
angle = MGLRadiansFromDegrees(mbgl::util::wrap(-camera.heading, 0., 360.));
1828+
angle = MGLRadiansFromDegrees(-camera.heading);
18291829
}
18301830
double pitch = -1;
18311831
if (camera.pitch >= 0)
@@ -1851,12 +1851,12 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
18511851
else // portrait
18521852
{
18531853
sw = _mbglMap->latLngForProjectedMeters({
1854-
centerMeters.northing - centerToEdge * std::cos(angle) + centerToEdge * std::cos(angle) * std::sin(pitch) / 2,
1855-
centerMeters.easting - centerToEdge * std::sin(angle) + centerToEdge * std::sin(angle) * std::sin(pitch) / 2,
1854+
centerMeters.northing - centerToEdge * std::cos(-angle) + centerToEdge * std::cos(-angle) * std::sin(pitch) / 2,
1855+
centerMeters.easting - centerToEdge * std::sin(-angle) + centerToEdge * std::sin(-angle) * std::sin(pitch) / 2,
18561856
});
18571857
ne = _mbglMap->latLngForProjectedMeters({
1858-
centerMeters.northing + centerToEdge * std::cos(angle) - centerToEdge * std::cos(angle) * std::sin(pitch) / 2,
1859-
centerMeters.easting + centerToEdge * std::sin(angle) - centerToEdge * std::sin(angle) * std::sin(pitch) / 2,
1858+
centerMeters.northing + centerToEdge * std::cos(-angle) - centerToEdge * std::cos(-angle) * std::sin(pitch) / 2,
1859+
centerMeters.easting + centerToEdge * std::sin(-angle) - centerToEdge * std::sin(-angle) * std::sin(pitch) / 2,
18601860
});
18611861
}
18621862

@@ -1865,7 +1865,7 @@ - (void)setCamera:(MGLMapCamera *)camera withDuration:(NSTimeInterval)duration a
18651865
mbgl::CameraOptions options = _mbglMap->cameraForLatLngs({ sw, ne }, {});
18661866
options.center = centerLatLng;
18671867

1868-
if (angle >= 0)
1868+
if (camera.heading >= 0)
18691869
{
18701870
options.angle = angle;
18711871
}

0 commit comments

Comments
 (0)