Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Description

@cammace

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]

Activity

  1. added
    Android
    on Oct 30, 2017
  2. tobrun commented on Nov 1, 2017

    @tobrun
    Member

    Fixed with #10324

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Android

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions