@@ -427,18 +427,24 @@ export interface ListOfflineRegionsOptions {
427427
428428// ------------------------------------------------------------
429429
430+ export enum ControlPosition {
431+ TOP_LEFT ,
432+ TOP_RIGHT ,
433+ BOTTOM_LEFT ,
434+ BOTTOM_RIGHT
435+ }
436+
430437/**
431438 * The options object passed into the show function.
432439 */
433-
434440export interface ShowOptions {
435441 accessToken : string ;
436442 /**
437443 * default 'streets'
438444 */
439- style ?: MapStyle ;
445+ style ?: string | MapStyle ;
440446 margins ?: ShowOptionsMargins ;
441- center ?: LatLng ;
447+ center ?: Partial < LatLng > ;
442448 /**
443449 * default 0 (which is almost the entire planet)
444450 */
@@ -451,14 +457,26 @@ export interface ShowOptions {
451457 * default false (required for the 'starter' plan)
452458 */
453459 hideLogo ?: boolean ;
460+ /**
461+ * default BOTTOM_LEFT
462+ */
463+ logoPosition ?: ControlPosition ;
454464 /**
455465 * default true
456466 */
457467 hideAttribution ?: boolean ;
468+ /**
469+ * default BOTTOM_LEFT
470+ */
471+ attributionPosition ?: ControlPosition ;
458472 /**
459473 * default false
460474 */
461475 hideCompass ?: boolean ;
476+ /**
477+ * default TOP_RIGHT
478+ */
479+ compassPosition ?: ControlPosition ;
462480 /**
463481 * default false
464482 */
@@ -479,52 +497,46 @@ export interface ShowOptions {
479497 * Immediately add markers to the map
480498 */
481499 markers ?: MapboxMarker [ ] ;
482-
483500 /**
484501 * callback on location permission granted
485502 *
486503 * Android Only
487504 */
488-
489505 onLocationPermissionGranted ?: any ;
490-
491506 /**
492507 * callback on location permission denied
493508 *
494509 * Android Only
495510 */
496-
497511 onLocationPermissionDenied ?: any ;
498-
499512 /**
500513 * callback on Map Ready
501514 */
502-
503515 onMapReady ?: any ;
504-
505516 /**
506517 * callback on scroll event
507518 */
508-
509519 onScrollEvent ?: any ;
510-
511520 /**
512521 * callback on move begin event
513522 */
514-
515523 onMoveBeginEvent ?: any ;
516-
517524 /**
518525 * Android context
519526 */
520-
521527 context ?: any ;
522-
523528 /**
524529 * Android parent View
525530 */
526-
527531 parentView ?: any ;
532+ /**
533+ * On Android by default there is a 200ms delay before showing the map to work around a race condition.
534+ */
535+ delay ?: number ;
536+ /**
537+ * See https://docs.mapbox.com/archive/android/maps/api/9.0.0/com/mapbox/mapboxsdk/location/LocationComponentOptions.html
538+ */
539+ locationComponentOptions : any ;
528540}
529541
530542// ------------------------------------------------------------
@@ -724,9 +736,8 @@ export interface MapboxApi {
724736
725737export abstract class MapboxCommon implements MapboxCommonApi {
726738 constructor ( public view ?: MapboxViewCommonBase ) { }
727- public static defaults = {
739+ public static defaults : Partial < ShowOptions > = {
728740 style : MapStyle . STREETS . toString ( ) ,
729- mapStyle : MapStyle . STREETS . toString ( ) ,
730741 margins : {
731742 left : 0 ,
732743 right : 0 ,
@@ -737,8 +748,11 @@ export abstract class MapboxCommon implements MapboxCommonApi {
737748 showUserLocation : false , // true requires adding `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` in the .plist
738749 locationComponentOptions : { } ,
739750 hideLogo : false , // required for the 'starter' plan
751+ logoPosition : ControlPosition . BOTTOM_LEFT , // The default position mimics constructor of MapboxMapOptions
740752 hideAttribution : true ,
753+ attributionPosition : ControlPosition . BOTTOM_LEFT , // The default position mimics constructor of MapboxMapOptions
741754 hideCompass : false ,
755+ compassPosition : ControlPosition . TOP_RIGHT , // The default position mimics constructor of MapboxMapOptions
742756 disableRotation : false ,
743757 disableScroll : false ,
744758 disableZoom : false ,
@@ -1152,13 +1166,25 @@ export const hideLogoProperty = new Property<MapboxViewCommonBase, boolean>({
11521166} ) ;
11531167hideLogoProperty . register ( MapboxViewCommonBase ) ;
11541168
1169+ export const logoPositionProperty = new Property < MapboxViewCommonBase , ControlPosition > ( {
1170+ name : 'logoPosition' ,
1171+ defaultValue : MapboxCommon . defaults . logoPosition
1172+ } ) ;
1173+ logoPositionProperty . register ( MapboxViewCommonBase ) ;
1174+
11551175export const hideAttributionProperty = new Property < MapboxViewCommonBase , boolean > ( {
11561176 name : 'hideAttribution' ,
11571177 defaultValue : MapboxCommon . defaults . hideAttribution ,
11581178 valueConverter : booleanConverter
11591179} ) ;
11601180hideAttributionProperty . register ( MapboxViewCommonBase ) ;
11611181
1182+ export const attributionPositionProperty = new Property < MapboxViewCommonBase , ControlPosition > ( {
1183+ name : 'attributionPosition' ,
1184+ defaultValue : MapboxCommon . defaults . attributionPosition
1185+ } ) ;
1186+ attributionPositionProperty . register ( MapboxViewCommonBase ) ;
1187+
11621188export const telemetryProperty = new Property < MapboxViewCommonBase , boolean > ( {
11631189 name : 'telemetry' ,
11641190 defaultValue : false ,
@@ -1173,6 +1199,12 @@ export const hideCompassProperty = new Property<MapboxViewCommonBase, boolean>({
11731199} ) ;
11741200hideCompassProperty . register ( MapboxViewCommonBase ) ;
11751201
1202+ export const compassPositionProperty = new Property < MapboxViewCommonBase , ControlPosition > ( {
1203+ name : 'compassPosition' ,
1204+ defaultValue : MapboxCommon . defaults . compassPosition
1205+ } ) ;
1206+ compassPositionProperty . register ( MapboxViewCommonBase ) ;
1207+
11761208export const disableZoomProperty = new Property < MapboxViewCommonBase , boolean > ( {
11771209 name : 'disableZoom' ,
11781210 defaultValue : MapboxCommon . defaults . disableZoom ,
@@ -1229,15 +1261,14 @@ export abstract class MapboxViewBase extends MapboxViewCommonBase {
12291261 public static locationPermissionGrantedEvent : string = 'locationPermissionGranted' ;
12301262 public static locationPermissionDeniedEvent : string = 'locationPermissionDenied' ;
12311263
1232- protected config : any = { } ;
1264+ protected config : Partial < ShowOptions > = { } ;
12331265
12341266 [ zoomLevelProperty . setNative ] ( value : number ) {
12351267 this . config . zoomLevel = + value ;
12361268 }
12371269
12381270 [ mapStyleProperty . setNative ] ( value : string ) {
12391271 this . config . style = value ;
1240- this . config . mapStyle = value ;
12411272 }
12421273
12431274 [ accessTokenProperty . setNative ] ( value : string ) {
@@ -1270,14 +1301,26 @@ export abstract class MapboxViewBase extends MapboxViewCommonBase {
12701301 this . config . hideLogo = value ;
12711302 }
12721303
1304+ [ logoPositionProperty . setNative ] ( value : ControlPosition ) {
1305+ this . config . logoPosition = value ;
1306+ }
1307+
12731308 [ hideAttributionProperty . setNative ] ( value : boolean ) {
12741309 this . config . hideAttribution = value ;
12751310 }
12761311
1312+ [ attributionPositionProperty . setNative ] ( value : ControlPosition ) {
1313+ this . config . attributionPosition = value ;
1314+ }
1315+
12771316 [ hideCompassProperty . setNative ] ( value : boolean ) {
12781317 this . config . hideCompass = value ;
12791318 }
12801319
1320+ [ compassPositionProperty . setNative ] ( value : ControlPosition ) {
1321+ this . config . compassPosition = value ;
1322+ }
1323+
12811324 [ disableZoomProperty . setNative ] ( value : boolean ) {
12821325 this . config . disableZoom = value ;
12831326 }
0 commit comments