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

User location tracking not animating #2791

Closed
tobrun opened this issue Oct 26, 2015 · 12 comments
Closed

User location tracking not animating #2791

tobrun opened this issue Oct 26, 2015 · 12 comments
Labels
Android Mapbox Maps SDK for Android

Comments

@tobrun
Copy link
Member

tobrun commented Oct 26, 2015

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.

@tobrun
Copy link
Member Author

tobrun commented Oct 26, 2015

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()

@tobrun
Copy link
Member Author

tobrun commented Oct 26, 2015

@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");

@tobrun
Copy link
Member Author

tobrun commented Oct 26, 2015

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()

@ljbade
Copy link
Contributor

ljbade commented Oct 26, 2015

Hmm this is very perplexing.

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

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Oct 26, 2015
@tobrun tobrun added this to the android-v2.2.0 milestone Oct 26, 2015
@1ec5
Copy link
Contributor

1ec5 commented Oct 27, 2015

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?

@ljbade ljbade added the P1 label Oct 27, 2015
@bleege bleege modified the milestones: android-v2.2.0, android-v2.3.0 Oct 28, 2015
@bleege bleege modified the milestones: android-v2.3.0, android-v2.4.0 Dec 4, 2015
@tobrun
Copy link
Member Author

tobrun commented Dec 11, 2015

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

@tobrun
Copy link
Member Author

tobrun commented Dec 11, 2015

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

@tobrun
Copy link
Member Author

tobrun commented Dec 11, 2015

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

@tobrun
Copy link
Member Author

tobrun commented Dec 12, 2015

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.

@tobrun
Copy link
Member Author

tobrun commented Dec 23, 2015

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

@tobrun
Copy link
Member Author

tobrun commented Dec 23, 2015

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

@tobrun tobrun closed this as completed Dec 23, 2015
@tobrun
Copy link
Member Author

tobrun commented Dec 23, 2015

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

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

4 participants