diff options
author | Tobrun Van Nuland <tobrun.van.nuland@gmail.com> | 2016-05-26 11:05:37 +0200 |
---|---|---|
committer | Tobrun Van Nuland <tobrun.van.nuland@gmail.com> | 2016-05-26 11:30:30 +0200 |
commit | cd517b90faee6942899edaa0001687718055c8b0 (patch) | |
tree | ce4323303be0a1a97923050db9ec6ef5afa9dcc8 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java | |
parent | 034246e00af154bdfe777e9b59ddb4703f2b1e89 (diff) | |
download | qtlocation-mapboxgl-cd517b90faee6942899edaa0001687718055c8b0.tar.gz |
[android] #5034 - calculate correct padding for left, top, right and bottom
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java index 1605a8c655..d37c3a02ea 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Projection.java @@ -57,13 +57,15 @@ public class Projection { public VisibleRegion getVisibleRegion() { LatLngBounds.Builder builder = new LatLngBounds.Builder(); - int viewportWidth = mMapView.getContentWidth(); - int viewportHeight = mMapView.getContentHeight(); + float left = mMapView.getContentPaddingLeft(); + float right = mMapView.getWidth() - mMapView.getContentPaddingRight(); + float top = mMapView.getContentPaddingTop(); + float bottom = mMapView.getHeight() - mMapView.getContentPaddingBottom(); - LatLng topLeft = fromScreenLocation(new PointF(0, 0)); - LatLng topRight = fromScreenLocation(new PointF(viewportWidth, 0)); - LatLng bottomRight = fromScreenLocation(new PointF(viewportWidth, viewportHeight)); - LatLng bottomLeft = fromScreenLocation(new PointF(0, viewportHeight)); + LatLng topLeft = fromScreenLocation(new PointF(left, top)); + LatLng topRight = fromScreenLocation(new PointF(right, top)); + LatLng bottomRight = fromScreenLocation(new PointF(right, bottom)); + LatLng bottomLeft = fromScreenLocation(new PointF(left, bottom)); builder.include(topLeft) .include(topRight) |