Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map animations are sometimes skipped #3275

Closed
smichel17 opened this issue Sep 9, 2021 · 7 comments
Closed

Map animations are sometimes skipped #3275

smichel17 opened this issue Sep 9, 2021 · 7 comments
Labels

Comments

@smichel17
Copy link
Member

There are two parts to this bug.

1. When two animations overlap, the second is skipped

How to Reproduce

It can be reproduced with any two animations, but this is the easiest/most obvious repro.

  1. "Fling" your finger across the screen to pan the map, so that there is some momentum and the map continues moving after you raise your finger.
  2. While the map is still moving, press the gps button
    • You need a gps fix for this, but it's not necessary in general; you can also reproduce with the zoom buttons.

Expected: Any of these:

  • The map will immediately come to a complete halt (no more momentum), then pan normally back to my location.
  • The first animation will finish and then the map will pan normally back to my location.
  • Something fancier where the animations are composed (but that's a lot of work to implement).

Actual: The map finishes moving due to momentum, then instantly snaps back to my location, skipping the animation.

Versions affected: Android 7.0 and StreetComplete v34.0, but it's been around for a while (maybe forever)

I propose not to fix this (unless it turns out to be easy)

2. Sometimes animations are totally locked out

How to Reproduce

I am not sure that this is 100% reliable, but it was this particular time when I tested:

  1. Same as above
  2. Same as above
  3. Press the zoom in/out button, or any other tap-button animation (compass button to tilt/rotate the map when unlocked, zooming to focus on the quest)
    • Panning and other "gesture animations" are not affected

Expected: Animation plays as normal, since there is no overlapping animation.

Actual: Camera instantly snaps to end state, as if it were still animating like above.

Sometimes panning around to arbitrary locations will fix this after some time.

I'm not sure if it's related, but also sometimes zooming to a quest simply doesn't happen, and the quest geometry ends up covered by the quest form.

One or both of these may be an upstream issue, I'm not sure.

@smichel17 smichel17 added the bug label Sep 9, 2021
@smichel17
Copy link
Member Author

I'll likely look into this eventually, but it's way far down my priority list; it won't be for a few months at least.

@matkoniecz
Copy link
Member

I am pretty sure that it is Tangram issue and maybe intentional.

@westnordost
Copy link
Member

I propose not to fix this (unless it turns out to be easy)

Ok.

Yeah the ... multiple-animations-at-the-same-time is not perfect. tangram-es does not support it at all, the CameraManager is some kind of compatibility layer to enable exactly that. Apparently there are small issues with that, but I will not fix them because #3123

@smichel17
Copy link
Member Author

It feels like you have both responded to "bug" 1, which I proposed not to fix, and skipped over responding to bug 2, which is about a single animation being skipped, i.e. the map getting "stuck" in a state of skipping animations.

@smichel17
Copy link
Member Author

smichel17 commented Sep 10, 2021

Perhaps this is a better demonstration of the problem. The first tilt and select quest are there to show the correct behavior. Then I trigger the bug and show the incorrect behavior.

sc-recording-trimmed-reencoded.mp4

Annoyingly, it's hard to get a good quality recording that's also small enough to upload directly here.

@smichel17
Copy link
Member Author

smichel17 commented Sep 10, 2021

I am pretty sure that it is Tangram issue and maybe intentional.

I am also pretty sure that "bug" 1, reproduced at 00:07 in the recording above, is intentional.
I am even more certain that bug 2, reproduced afterwards, is not.

While playing around to get the recording, I found that the fix is to do another "fling" of the map and let it come to a complete stop. So basically, the probably-intentional lock-out is not being lifted when the fling is "interrupted" by another animation.

@smichel17
Copy link
Member Author

I should not have gotten sucked into looking at this, but I did. I'll stop here, but my current best guess is that it might be related to one of these callbacks, where we respond differently depending on whether there is currently an animation playing.

override fun onRegionWillChange(animated: Boolean) {
// could be called not on the ui thread, see https://github.com/tangrams/tangram-es/issues/2157
lifecycleScope.launch {
calledOnMapIsChangingOnce = false
if (!cameraManager.isAnimating) {
mapChangingListener?.onMapWillChange()
if (animated) flingAnimator.start()
}
}
}

override fun onRegionDidChange(animated: Boolean) {
lifecycleScope.launch {
if (!cameraManager.isAnimating) {
if (!calledOnMapIsChangingOnce) mapChangingListener?.onMapIsChanging()
mapChangingListener?.onMapDidChange()
if (animated) flingAnimator.end()
}
}
}
})
}

Docs describing the callbacks here: https://tangrams.readthedocs.io/en/master/API-Reference/android-sdk/0.11.0/com/mapzen/tangram/MapChangeListener.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants