Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Commit

Permalink
[ANMA-8545] Duplicate Mapbox request mapbox#16448
Browse files Browse the repository at this point in the history
  • Loading branch information
pmerletmappy committed May 4, 2020
1 parent 83229cc commit 60f2ea1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mbgl/map/transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,9 @@ double Transform::getMaxPitchForEdgeInsets(const EdgeInsets& insets) const {
// We use half of fov, as it is field of view above perspective center.
// With inset, this angle changes and tangentOfFovAboveCenterAngle = (h/2 + centerOffsetY) / (height * 1.5).
// 1.03 is a bit extra added to prevent parallel ground to viewport clipping plane.
const double tangentOfFovAboveCenterAngle = 1.03 * (height / 2.0 + centerOffsetY) / (1.5 * height);
// * Mappy Modif : 2.4 is an arbitrary factor to prevent too much depth when the top offset is important.
// * See https://github.com/mapbox/mapbox-gl-native/pull/16448
const double tangentOfFovAboveCenterAngle = 1.03 * (height / 2.0 + centerOffsetY * 2.4) / (1.5 * height);
const double fovAboveCenter = std::atan(tangentOfFovAboveCenterAngle);
return M_PI * 0.5 - fovAboveCenter;
// e.g. Maximum pitch of 60 degrees is when perspective center's offset from the top is 84% of screen height.
Expand Down

0 comments on commit 60f2ea1

Please sign in to comment.