Merge pull request #1971 from mapbox/fix-screen-conversion

compensate for Android screen ratio in conversion routines
This commit is contained in:
Justin R. Miller
2015-07-30 16:37:26 -07:00

View File

@@ -490,11 +490,12 @@ public class MapView extends SurfaceView {
}
public LatLng fromScreenLocation(PointF point) {
return mNativeMapView.latLngForPixel(point);
return mNativeMapView.latLngForPixel(new PointF(point.x / mScreenDensity, point.y / mScreenDensity));
}
public PointF toScreenLocation(LatLng location) {
return mNativeMapView.pixelForLatLng(location);
PointF point = mNativeMapView.pixelForLatLng(location);
return new PointF(point.x * mScreenDensity, point.y * mScreenDensity);
}
//