[android] Add API to be able to set insets on MapView.
This commit is contained in:
committed by
Brad Leege
parent
0d3af14375
commit
c114ed6562
@@ -278,6 +278,10 @@ public final class MapView extends FrameLayout {
|
||||
private boolean mTiltEnabled = true;
|
||||
private boolean mAllowConcurrentMultipleOpenInfoWindows = false;
|
||||
private String mStyleUrl;
|
||||
private int mContentPaddingLeft;
|
||||
private int mContentPaddingTop;
|
||||
private int mContentPaddingRight;
|
||||
private int mContentPaddingBottom;
|
||||
|
||||
//
|
||||
// Inner classes
|
||||
@@ -4341,6 +4345,38 @@ public final class MapView extends FrameLayout {
|
||||
setWidgetMargins(mAttributionsView, left, top, right, bottom);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the distance from the edges of the map view’s frame to the edges of the map
|
||||
* view’s logical viewport.
|
||||
*
|
||||
* When the value of this property is equal to {0,0,0,0}, viewport
|
||||
* properties such as `centerCoordinate` assume a viewport that matches the map
|
||||
* view’s frame. Otherwise, those properties are inset, excluding part of the
|
||||
* frame from the viewport. For instance, if the only the top edge is inset, the
|
||||
* map center is effectively shifted downward.
|
||||
*
|
||||
* @param left The left margin in pixels.
|
||||
* @param top The top margin in pixels.
|
||||
* @param right The right margin in pixels.
|
||||
* @param bottom The bottom margin in pixels.
|
||||
*/
|
||||
@UiThread
|
||||
public void setContentPadding(int left, int top, int right, int bottom) {
|
||||
|
||||
if (left == mContentPaddingLeft && top == mContentPaddingTop && right == mContentPaddingRight && bottom == mContentPaddingBottom) {
|
||||
return;
|
||||
}
|
||||
|
||||
mContentPaddingLeft = left;
|
||||
mContentPaddingTop = top;
|
||||
mContentPaddingRight = right;
|
||||
mContentPaddingBottom = bottom;
|
||||
|
||||
mNativeMapView.setContentPadding(top / mScreenDensity, left / mScreenDensity, bottom / mScreenDensity, right / mScreenDensity);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Enables or disables the attribution button. The attribution is a button with an "i" than when
|
||||
|
||||
6
platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java
Normal file → Executable file
6
platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/NativeMapView.java
Normal file → Executable file
@@ -336,6 +336,10 @@ final class NativeMapView {
|
||||
nativeRotateBy(mNativeMapViewPtr, sx, sy, ex, ey, duration);
|
||||
}
|
||||
|
||||
public void setContentPadding(double top, double left, double bottom, double right) {
|
||||
nativeSetContentPadding(mNativeMapViewPtr, top, left, bottom, right);
|
||||
}
|
||||
|
||||
public void setBearing(double degrees) {
|
||||
setBearing(degrees, 0);
|
||||
}
|
||||
@@ -591,6 +595,8 @@ final class NativeMapView {
|
||||
private native void nativeRotateBy(long nativeMapViewPtr, double sx,
|
||||
double sy, double ex, double ey, long duration);
|
||||
|
||||
private native void nativeSetContentPadding(long nativeMapViewPtr, double top, double left, double bottom, double right);
|
||||
|
||||
private native void nativeSetBearing(long nativeMapViewPtr, double degrees,
|
||||
long duration);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user