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

The animation of the location component has lags when the RenderMode.COMPASS and mapbox_elevation=0dp are set #736

Open
Copatych opened this issue Jul 21, 2022 · 0 comments

Comments

@Copatych
Copy link

Environment

  • Devices affected: Galaxy A50 (Android 11), Redmi Note 7 (Android 10), etc
  • Maps SDK Version: 9.7.2

Observed behavior and steps to reproduce

The animation of the location component has lags when the RenderMode.COMPASS and mapbox_elevation=0dp are set. Code to reproduce the bug

    private lateinit var mapView: MapView

    @SuppressLint("MissingPermission")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        Mapbox.getInstance(this, getString(R.string.mapbox_access_token))
        setContentView(R.layout.activity_main)

        mapView = findViewById(R.id.mapView)
        mapView.onCreate(savedInstanceState)

        mapView.getMapAsync { mapboxMap ->
            mapboxMap.setStyle(Style.MAPBOX_STREETS) { style ->
                mapboxMap.locationComponent.apply {
                    val options = LocationComponentActivationOptions.builder(this@MainActivity, style)
                        .useDefaultLocationEngine(false)
                        .locationEngine(null)
                        .styleRes(R.style.MapView_LocationComponent)
                        .build()

                    activateLocationComponent(options)
                    isLocationComponentEnabled = true
                    renderMode = RenderMode.COMPASS
                }
            }

            mapboxMap.addOnMapClickListener { point ->
                val location = Location(LocationManager.GPS_PROVIDER).apply {
                    latitude = point.latitude
                    longitude = point.longitude
                    altitude = point.altitude
                    accuracy = 3f
                    bearing = Random.nextFloat() * 360
                    speed = Random.nextFloat() * 15
                    time = System.currentTimeMillis()
                }

                mapboxMap.locationComponent.forceLocationUpdate(LocationUpdate.Builder().location(location).build())

                true
            }
        }
    }
...
<style name="MapView.LocationComponent" parent="@style/mapbox_LocationComponent">
        <item name="mapbox_elevation">0dp</item>
    </style>

Video example of bug:

Screen_Recording_20220721-104945_MapboxLocationComponentBug.mp4

Notes / preliminary analysis

When RenderMode.GPS or mapbox_elevation=1dp are used, the lags disappear, the animation becomes smooth, beautiful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant