forked from organicmaps/organicmaps
Fix scales::GetRectForLevel according to possible mercator bounds.
This commit is contained in:
parent
0ff0e2de54
commit
63c86c78d1
2 changed files with 5 additions and 2 deletions
|
@ -50,7 +50,7 @@ struct MercatorBounds
|
|||
{
|
||||
lat = my::clamp(lat, -86.0, 86.0);
|
||||
double const res = my::RadToDeg(log(tan(my::DegToRad(45.0 + lat * 0.5))));
|
||||
return my::clamp(res, -180.0, 180.0);
|
||||
return ClampY(res);
|
||||
}
|
||||
|
||||
inline static double XToLon(double x)
|
||||
|
|
|
@ -68,7 +68,10 @@ namespace scales
|
|||
ASSERT_GREATER ( xL, 0.0, () );
|
||||
ASSERT_GREATER ( yL, 0.0, () );
|
||||
|
||||
return m2::RectD(center.x - xL, center.y - yL, center.x + xL, center.y + yL);
|
||||
return m2::RectD(MercatorBounds::ClampX(center.x - xL),
|
||||
MercatorBounds::ClampY(center.y - yL),
|
||||
MercatorBounds::ClampX(center.x + xL),
|
||||
MercatorBounds::ClampY(center.y + yL));
|
||||
}
|
||||
|
||||
namespace
|
||||
|
|
Loading…
Add table
Reference in a new issue