[core, ios, osx, android, glfw] Flipped origin of Map::latLngForPixel(), Map::pixelForLatLng()

Map and Transform methods assume an origin at the top-left corner of the view, like iOS, Android, and GLFW but unlike OS X. Transform is responsible for flipping coordinates between the top-left origin of Map and the bottom-left origin of TransformState.

Fixes #3574.
This commit is contained in:
Minh Nguyễn
2016-01-15 15:13:16 -08:00
committed by Minh Nguyễn
parent bf87eaa7b8
commit 47b69100f9
7 changed files with 42 additions and 42 deletions

View File

@@ -641,3 +641,17 @@ void Transform::cancelTransitions() {
void Transform::setGestureInProgress(bool inProgress) {
state.gestureInProgress = inProgress;
}
#pragma mark Conversion and projection
PrecisionPoint Transform::latLngToPoint(const LatLng& latLng) const {
PrecisionPoint point = state.latLngToPoint(latLng);
point.y = state.height - point.y;
return point;
}
LatLng Transform::pointToLatLng(const PrecisionPoint& point) const {
PrecisionPoint flippedPoint = point;
flippedPoint.y = state.height - flippedPoint.y;
return state.pointToLatLng(flippedPoint);
}