[android] #5034 - calculate correct padding for left, top, right and bottom

This commit is contained in:
Tobrun Van Nuland
2016-05-26 11:05:37 +02:00
parent 034246e00a
commit cd517b90fa
2 changed files with 8 additions and 8 deletions

View File

@@ -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)

View File

@@ -40,8 +40,6 @@
android:layout_width="@dimen/map_padding_right"
android:layout_height="match_parent"
android:layout_gravity="end"
android:layout_marginLeft="@dimen/map_padding_left"
android:layout_marginStart="@dimen/map_padding_left"
android:alpha="0.5"
android:layout_marginTop="?attr/actionBarSize"
android:background="@color/mapbox_blue" />