[core] Fix screen coordinates when crossing the antimeridian (#2)

Added missing case. Really fixes #4155 this time.
This commit is contained in:
Bruno de Oliveira Abinader
2016-03-11 02:38:48 +02:00
parent 4bcc24d5af
commit f73beb5913
3 changed files with 18 additions and 2 deletions

View File

@@ -667,7 +667,7 @@ ScreenCoordinate Transform::latLngToScreenCoordinate(const LatLng& latLng) const
// to the center side.
double longitude = latLng.longitude;
const double centerLng = getLatLng().longitude;
if (centerLng - latLng.longitude > util::LONGITUDE_MAX) {
if (std::abs(centerLng - latLng.longitude) > std::abs(util::LONGITUDE_MAX)) {
if (centerLng > 0 && latLng.longitude < 0) {
longitude += util::DEGREES_MAX;
} else if (centerLng < 0 && latLng.longitude > 0) {