-
-
Notifications
You must be signed in to change notification settings - Fork 340
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
On compass press, tilt map if not tilted, when not tracking location #1725
Conversation
title is terrible but the context is in #1724 so you know what I'm going for. |
You are quite hands-on. Okay, let's try out how users will accept this feature. I'll merge it once the problem with the "almost 0f" is resolved. :-) |
:D I've done enough Android development to be comfortable source diving a bit. If I needed to do larger changes I'd leave it to you, but for a change like this, that doesn't require me to look at many files, it's less than an hour of work… that's reasonable.
Pushed a commit to work around it, most of the time, just by ignoring very small values. Although it does not fix the bug (my best guess is that it's a tangram-es bug, with a missing callback on their animator), I do not consider this a hack, because at rotation/tilt values that small it would look to the user like the map is flat. There is still one issue: sometimes the |
The rotation and tilt is in radians, if I remember correctly. So 6.28... would again be north I guess. |
I can't reproduce it or I do not understand the repro. |
Your hint about radians was good. I think it getting stuck at ~6.28 was also due to the "almost 0f" bug — it did not quite make it all the way around to 2pi. I added a check for being close to 2pi, also, and now it seems to work pretty well. Do you want me to squash the commits? |
It's kind of irrelevant now that it's fixed, but the steps were:
|
Ah! I dove a bit deeper and the animator is in SC, not tangram. I think I'm going to let you fix this one. The fix is super easy but understanding all the related code and figuring out the right spot for the fix will take longer than I want to spend on this. Here's the deal: Over in (This isn't documented anywhere that I know of, I had to discover through way-too-much-experience struggling with ValueAnimators) |
Never mind, this was not actually hard to fix. |
be1d9de
to
6437bea
Compare
Okay, rebased so history is nice. I also used kotlin's |
app/src/main/java/de/westnordost/streetcomplete/map/tangram/CameraManager.kt
Outdated
Show resolved
Hide resolved
f7d52cb
to
b7302ac
Compare
Additional newly-discovered benefit of this: Makes it easier to use 3d with touchscreen gloves, which work fine for taps but aren't great for gestures. |
Helps with map "flicker"
5f27b54
to
ad428db
Compare
Rebased; I think this is ready to merge, assuming you also want the second commit. |
Looks great! Sorry for the long forth and back for such a small change |
This implementation does not currently work because even when the tilt has been set to 0f, it usually reports being very slightly tilted (eg, tilt=5.317779E-7) and thus, isFlat is almost always false.
If you spam click the compass button, it will occasionally report
tilt=0f
and work properly. I'm not sure exactly why this is.