Refactor user location annotation; add accuracy ring - #1222
Conversation
|
Thanks for completing and cleaning up this feature, @friedbunny! It looks good to me, although we’re going to save this PR for beta 2. We’d like to reduce code churn and focus on stability in beta 1. Feel free to run with the tail work you listed above in the meantime. |
|
Sure thing, I definitely agree that these enhancements are a better fit for beta 2. I'm planning on having a go at the heading indicator today/soon, we'll see what else comes up during that. For now, I've got every |
|
If we could set the color (tint color?) of the location annotation from the client, that would be awesome. Just my $0.02. |
|
@picciano This and the current implementation both sync their color with the map view's tint color, which should probably be the same as the global app tint color. If you do something like I think it might be interesting to add setters for the different layers' colors, but I'm going to leave any developer API choices to the professionals. ;) |
|
@friedbunny Ah, didn't even realize that, perfect. |
|
Now supports heading indicator tint adjustments and accuracy-based size changes. This looks useful if there's ever a want to animate the heading accuracy changes. |
|
@friedbunny Tested this branch, and it is very neat – awesome! Found one issue with heading tracking though. If you enable viewport rotation in the test app and rotate the device to landscape, the heading indicator is 90deg off. Resetting heading tacking after rotation fixes this. |
|
Thanks @kristfal, I'll fix that when I come back to this (which should be next week or so). |
|
@friedbunny Cheers, no need to rush it though ;) |
|
Rebased onto |
|
@1ec5 Can you do a code review here and merge when ready? |
|
While I love the looks of this, b2 is focused on features leading to increased adoption right now. This is a lot of code, makes things diverge from our iOS SDK codebase, and isn't directly related to adoption. |
|
@1ec5 Thanks, I'll push those changes shortly. @incanus 😢 These changes are fairly significant, but self-contained. Even with the rotation fix I need to add, merging should be painless, whenever it does go in. I've been using this in Treble and I'll keep putting it through its paces there, in the meantime. I don't think #1550 is related, but that will need investigating. The only side effects I foresee at this point are potential performance issues with the switch to |
Yeah, agreed. Nothing personal 😄 We need to get our b2 game rolling and ship quicker than b1, but once we get into that flow, we'll keep gobbling the submissions. But even now, b2 talk is cart before horse... |
|
Rebased this on |
Adds: - Accuracy ring - Heading indicator Fixes: - Pulse sync - Visual appearance (removes slight aliasing) Closes #1222 (squashed)
|
Closed in favor of squash in #2010. |
Adds: - Accuracy ring - Heading indicator Fixes: - Pulse sync - Visual appearance (removes slight aliasing) Closes #1222 (squashed)
Adds: - Accuracy ring - Heading indicator Fixes: - Pulse sync - Visual appearance (removes slight aliasing) Closes mapbox#1222 (squashed)


In digging around the user location annotation to fix its shadow (#1204), I saw some things that were a little rough and ended up reworking the entire thing. Hopefully this can be considered for beta 2, if everything hasn't moved entirely GL by that time.
I cribbed from Sam Vermette's SVPulsingAnnotationView and converted entirely to
CALayer, which has a couple advantages for this application: smoother edges on the animated circles and the ability to use a single, more comprehensible API.Even though pre-rendered
UIImageis the almost always the most performant and best way to go, I was surprised that I couldn't find any measurable difference or slowdown when using rasterizedCALayerhere. Please test and let me know how you measured!Things to look for, mostly inspired by MapKit:
Things needing attention:
Accuracy ring changes are out of sync (should probably be converted to a GL circle annotation)Oh, I also tested this on my sluggish iPad Mini (A5) and even it seemed fine.