简体   繁体   中英

While user tracking is on zoom on user location

I am using the version of mapbox-android-sdk and mapbox-android-plugin-locationlayer

// Mapbox
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.6.1'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-locationlayer:0.11.0'

One problem I am facing is, once I enable user tracking by setting cameraMode to TRACKING like below:

mapboxMap.locationComponent.cameraMode = CameraMode.TRACKING

When I zoom in/out into the map the zoomed location changes from the user tracked position to the pinched/zoomed location of the screen.

Any idea on how to zoom in/out and keep the tracked user location centered and tracking enabled?

When you activate your location component, you can add LocationComponentOptions with trackingGesturesManagement enabled

val options = LocationComponentOptions.builder(context)
    .trackingGesturesManagement(true)
    .build()
mapboxMap?.locationComponent?.activateLocationComponent(context!!, options)

https://www.mapbox.com/android-docs/api/map-sdk/6.6.0/com/mapbox/mapboxsdk/location/LocationComponentOptions.html#trackingGesturesManagement--

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM