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.

User location tracking not animating #2791

Closed

Description

@tobrun

User location tracking landed it #2758
We are now calling setCenterCoordinate(mMarkerCoordinate, true /*animated*/) to reposition.
Currently no animation is occuring and map jumps from one location to another.
Probably a clearTransitions is called somewhere down the event chain.

Activity

  1. tobrun commented on Oct 26, 2015

    @tobrun
    MemberAuthor

    Build project using BUILDTYPE=Debug make android
    Added start and end logs to the method mentioned above.

    This results in following output:

    10-26 12:16:28.021 20557-20557/? E/TAG: START
    10-26 12:16:28.021 20557-20557/? D/mbgl: {Main}[JNI]: nativeCancelTransitions
    10-26 12:16:28.021 20557-20557/? D/mbgl: {Main}[JNI]: nativeSetLatLng
    10-26 12:16:28.021 20557-20557/? D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 12:16:28.021 20557-20557/? E/TAG: END
    10-26 12:16:28.021 20557-20557/? D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 12:16:28.021 20557-20557/? D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 12:16:28.023 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 12:16:28.027 20557-20557/? D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 12:16:28.027 20557-20557/? D/mbgl: {Main}[JNI]: nativeIsPaused
    10-26 12:16:28.027 20557-20557/? D/mbgl: {Main}[JNI]: nativeRenderSync
    10-26 12:16:28.027 20557-20557/? D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 12:16:28.027 20557-20557/? D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 12:16:28.028 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::beforeRender()
    10-26 12:16:28.032 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::afterRender()
    10-26 12:16:28.033 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::updateFps()
    10-26 12:16:28.033 20557-20557/? D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 12:16:28.036 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 12:16:28.036 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 12:16:28.042 20557-20557/? D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 12:16:28.043 20557-20557/? D/mbgl: {Main}[JNI]: nativeGetBearing
    10-26 12:16:28.043 20557-20557/? D/mbgl: {Main}[JNI]: nativePixelForLatLng
    10-26 12:16:28.043 20557-20557/? D/mbgl: {Main}[JNI]: nativeGetZoom
    10-26 12:16:28.043 20557-20557/? D/mbgl: {Main}[JNI]: nativeGetMetersPerPixelAtLatitude
    10-26 12:16:28.044 20557-21214/? D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    
  2. tobrun commented on Oct 26, 2015

    @tobrun
    MemberAuthor

    @ljbade indicated to add a log message to cancelTransitions in transform.cpp.
    I found out that you can add a logger by using this include:

    #include <mbgl/platform/log.hpp>

    and

    mbgl::Log::Error(mbgl::Event::JNI, "canceltransitions in transform.cpp", "canceltransitions");
  3. tobrun commented on Oct 26, 2015

    @tobrun
    MemberAuthor

    With previous comment in place I'm seeing:

    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp E/TAG: START
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeCancelTransitions
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp E/mbgl: {Main}[JNI]: canceltransitions in transform.cpp
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeSetLatLng
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp E/TAG: END
    10-26 13:07:24.017 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 13:07:24.017 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 13:07:24.017 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.017 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.033 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 13:07:24.034 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeIsPaused
    10-26 13:07:24.034 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.034 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeRenderSync
    10-26 13:07:24.034 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.034 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.034 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::beforeRender()
    10-26 13:07:24.042 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::afterRender()
    10-26 13:07:24.043 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::updateFps()
    10-26 13:07:24.043 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.045 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.053 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeUpdate
    10-26 13:07:24.053 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::invalidate()
    10-26 13:07:24.053 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeIsPaused
    10-26 13:07:24.053 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[JNI]: nativeRenderSync
    10-26 13:07:24.054 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.054 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    10-26 13:07:24.054 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::beforeRender()
    10-26 13:07:24.061 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::afterRender()
    10-26 13:07:24.061 15429-15997/com.mapbox.mapboxgl.testapp D/mbgl: {Map}[Android]: NativeMapView::updateFps()
    10-26 13:07:24.062 15429-15429/com.mapbox.mapboxgl.testapp D/mbgl: {Main}[Android]: NativeMapView::notifyMapChange()
    
  4. ljbade commented on Oct 26, 2015

    @ljbade
    Contributor

    Hmm this is very perplexing.

    @1ec5 Do you have any ideas why a pan animation is not working?

  5. added
    Android
    on Oct 26, 2015
  6. added this to the android-v2.2.0 milestone on Oct 26, 2015
  7. 1ec5 commented on Oct 27, 2015

    @1ec5
    Contributor

    I’m not sure, but MapView cancels transitions when programmatically setting the map’s center coordinates (#2296), whereas MGLMapView does not (#2313). Could something else (a listener, perhaps) be setting the center coordinate, preempting the animation?

  8. modified the milestones: android-v2.3.0, on Dec 4, 2015
  9. tobrun commented on Dec 11, 2015

    @tobrun
    MemberAuthor

    I have been running at this issue this morning but feel that I have not much wiser at this point.

    I have investigated following trajectories:

    • Multiple setCenterCoordinates as @1ec5 indicated
    • Multiple location updates
    • Revisited cancelTransitions approach
  10. tobrun commented on Dec 11, 2015

    @tobrun
    MemberAuthor

    I'm starting to believe that this problem is bigger than the animation only. There is a huge difference in log ouput with BUILDTYPE=Debug make android when comparing a Map without the UserLocationView versus a Map with the UserLocationView. This is probably related to keeping the UserLocationView in sync with the map, a confirmation of this can be found in #3207

  11. tobrun commented on Dec 11, 2015

    @tobrun
    MemberAuthor

    I'm going to whip up a simple View and see if I'm able to animate that one instead

  12. tobrun commented on Dec 12, 2015

    @tobrun
    MemberAuthor

    I whipped up the most simple example possible, a marker centered in the map and a location listener setting setCenterCoordinate(latLng, true /*animated*/). This results in following clip where you can see it is not animating.

  13. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    The PR for #3283 animates the map correctly \o/

  14. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    Now noticing another issue, jitter of the userdot on high zoom level.
    Closing this issue in favor of #3283.

  15. tobrun commented on Dec 23, 2015

    @tobrun
    MemberAuthor

    Linking the master issue #2049 for progress on the topic for UserLocationTracking

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions