Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Mapbox return target 0 inside onFinish when use moveCamera #10314

Closed
cammace opened this issue Oct 30, 2017 · 1 comment
Closed

Mapbox return target 0 inside onFinish when use moveCamera #10314

cammace opened this issue Oct 30, 2017 · 1 comment
Labels
Android Mapbox Maps SDK for Android

Comments

@cammace
Copy link
Contributor

cammace commented Oct 30, 2017

Originally ticketed in Mapbox Java by @PhanVanLinh

Here is my function to move to a specific place then add a marker

private void moveToVN(final MapboxMap mapboxMap) {
        final LatLng latLng = new LatLng(16.0667433, 108.2138483);
        mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(latLng), new MapboxMap.CancelableCallback() {
            @Override
            public void onCancel() {
                Log.i(TAG, "moveCamera onCancel");
            }

            @Override
            public void onFinish() {
                Log.i(TAG, "moveCamera onFinish " + mapboxMap.getCameraPosition().target.toString());
                mapboxMap.addMarker(new MarkerViewOptions().anchor(0.5f, 0.5f)
                        .icon(IconFactory.getInstance(getActivity()).fromResource(R.mipmap.ic_launcher_round))
                        .position(latLng), new MarkerViewManager.OnMarkerViewAddedListener() {
                    @Override
                    public void onViewAdded(@NonNull MarkerView markerView) {
                        Log.i(TAG, "onViewAdded");
                    }
                });
            }
        });
    }
Here is the logcat

Logcat

moveCamera onFinish LatLng [latitude=0.0, longitude=0.0, altitude=0.0]
onViewAdded

You will see that the target inside onFinish is [latitude=0.0, longitude=0.0, altitude=0.0], I think it should be [latitude=16.0667433, longitude=108.2138483, altitude=0.0].
Because if I use animateCamera or easeCamera, it will return [latitude=16.0667433, longitude=108.2138483, altitude=0.0]

@tobrun
Copy link
Member

tobrun commented Nov 1, 2017

Fixed with #10324

@tobrun tobrun closed this as completed Nov 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

No branches or pull requests

2 participants