Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] #5034 - calculate correct padding for left, top, right and …
Browse files Browse the repository at this point in the history
…bottom
  • Loading branch information
tobrun committed May 26, 2016
1 parent 034246e commit cd517b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ public LatLng fromScreenLocation(PointF point) {
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down

0 comments on commit cd517b9

Please sign in to comment.