Skip to content

Commit 79f98a0

Browse files
committed
fix: correctly implement padding
1 parent b1df222 commit 79f98a0

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/mapbox.android.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2079,7 +2079,7 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
20792079
.include(new com.mapbox.mapboxsdk.geometry.LatLng(options.bounds.south, options.bounds.west))
20802080
.build();
20812081

2082-
const padding = 25,
2082+
const padding = options.padding !== undefined ? options.padding : 25,
20832083
animated = options.animated === undefined || options.animated,
20842084
durationMs = animated ? 1000 : 0;
20852085

src/mapbox.ios.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1914,12 +1914,8 @@ export class Mapbox extends MapboxCommon implements MapboxApi {
19141914
const animated = options.animated === undefined || options.animated;
19151915

19161916
// support defined padding
1917-
const padding: UIEdgeInsets = Mapbox.merge(options.padding === undefined ? {} : options.padding, {
1918-
top: 25,
1919-
left: 25,
1920-
bottom: 25,
1921-
right: 25
1922-
});
1917+
const padding: UIEdgeInsets =
1918+
options.padding !== undefined ? { top: options.padding, left: options.padding, bottom: options.padding, right: options.padding } : { top: 25, left: 25, bottom: 25, right: 25 };
19231919

19241920
theMap.setVisibleCoordinateBoundsEdgePaddingAnimated(bounds, padding, animated);
19251921
resolve();

0 commit comments

Comments
 (0)