mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
478 stars 134 forks source link

easeTo() not working #2449

Closed lywedo closed 3 months ago

lywedo commented 3 months ago

Environment

Observed behavior and steps to reproduce

I upgraded mapbox from v9 -> v10, the original code is

val cameraUpdate = CameraUpdateFactory.newLatLngBounds(latLongBounds, padding)
        mapboxMap.easeCamera(cameraUpdate)

now, I change the code here to

mapView?.getMapboxMap()?.apply {
            setCamera(cameraOptions)
            easeTo(EASE_TO_TARGET_CAMERA_POSITION, prepareAnimationOptions(2000))
private fun prepareAnimationOptions(duration: Long) = mapAnimationOptions {
        duration(duration)
        animatorListener(object : AnimatorListenerAdapter() {

        })
    }
    private val EASE_TO_TARGET_CAMERA_POSITION = cameraOptions {
        center(Point.fromLngLat(-0.07520, 51.50550))
        zoom(17.0)
        bearing(180.0)
        pitch(30.0)
    }

the map still stays in the initial position when running

Expected behavior

It should move to the right position

Notes / preliminary analysis

Additional links and references

jush commented 3 months ago

@lywedo your code looks good to me.

When are you calling that code? I wonder if mapView or getMapboxMap() could be null.

lywedo commented 3 months ago

@lywedo your code looks good to me.

When are you calling that code? I wonder if mapView or getMapboxMap() could be null.

They are not null, I am debugging it, they could be seen in the snapshot image

jush commented 3 months ago

I see. Then the problem seems to be somewhere else.

I tried your code on top of the SimpleMapActivity and it works properly.

Could you please share a small app that reproduces the problem?