Repository navigation
User location dot example - #50
Conversation
| if (!_dot) { | ||
| _dot = [CALayer layer]; | ||
| _dot.bounds = CGRectMake(0, 0, _size, _size); | ||
| _dot.position = CGPointMake(_size / 2, _size / 2); |
There was a problem hiding this comment.
Setting frame would be simpler than setting both bounds and position (×4).
|
@mayagao, what’s left here? |
876bb5a to
c2bc39d
Compare
|
To do:
|
3cbed75 to
6120402
Compare
| 96D431FC1C84B4F7007D09D1 /* DrawingACustomMarkerExample.m in Sources */ = {isa = PBXBuildFile; fileRef = 96D431FB1C84B4F7007D09D1 /* DrawingACustomMarkerExample.m */; }; | ||
| 96D432061C84B9CF007D09D1 /* pisavector.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96D432051C84B9CF007D09D1 /* pisavector.xcassets */; }; | ||
| BBD05676206B24335DEA52C4 /* Pods_ExamplesUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7692D1D792EB3849E8754E6B /* Pods_ExamplesUITests.framework */; }; | ||
| BBD05676206B24335DEA52C4 /* (null) in Frameworks */ = {isa = PBXBuildFile; }; |
There was a problem hiding this comment.
This doesn’t seem right... 🤔
|
This PR has lost the ObjC implementation from #30 and instead has a mostly blank file at:
|
| // Created by Nadia Barbosa on 12/13/16. | ||
| // Copyright © 2016 Mapbox. All rights reserved. | ||
| // | ||
|
|
There was a problem hiding this comment.
This file seems misplaced.
There was a problem hiding this comment.
it was missing from my version, not sure if it's needed. Can remove it if it's not necessary :)
There was a problem hiding this comment.
I’m guessing it’s not necessary — that file already exists in the Objective-C folder.
04ebf73 to
b7db8b6
Compare
|
I think this is ready for review. Added some comments to @mayagao's code! |
| } | ||
|
|
||
| - (void)update { | ||
| // This method can be called many times a second, so be careful to keep it lightweight. |
There was a problem hiding this comment.
I think we should explain more about the role/origin of -update. It’s inherited from MGLUserLocationAnnotationView and is essentially mandatory for every implementation.
|
|
||
| // Rotate the arrow according to the user’s heading. | ||
| CGAffineTransform rotation = CGAffineTransformRotate( | ||
| CGAffineTransformIdentity, |
There was a problem hiding this comment.
Let’s move the indentation left here.
|
|
||
| // Create subclass of MGLUserLocationAnnotationView. | ||
| class CustomUserLocationAnnotationView: MGLUserLocationAnnotationView { | ||
| let size: CGFloat = 23 |
There was a problem hiding this comment.
ObjC has this set to 25 — let’s make it consistent (either way).
| arrowSize = size / 2.5 | ||
| arrow = CAShapeLayer() | ||
| arrow.path = arrowPath() | ||
| arrow.bounds = CGRect(x: 0, y: (size/2 + 2), width: arrowSize, height: arrowSize) |
There was a problem hiding this comment.
What does size/2 + 2 do here? In general, it’d be good to eliminate any inconsistencies between the ObjC and Swift implementations.
Sorry, I realize I wrote most of this.
| arrow = CAShapeLayer() | ||
| arrow.path = arrowPath() | ||
| arrow.bounds = CGRect(x: 0, y: (size/2 + 2), width: arrowSize, height: arrowSize) | ||
| arrow.bounds = CGRect(x: 0, y: 0, width: arrowSize, height: arrowSize) |
There was a problem hiding this comment.
The arrow never appears after this change, because it has no position. Going back to a suggestion @1ec5 made long ago in #30 (comment), it would probably be better to set a frame (and not have to worry about bounds+position.)
|
Noting that the above issue may be related to mapbox/mapbox-gl-native#8874 |
1a604fd to
f8efda1
Compare
|
An interesting direction to take this example could be to introduce some variability into the styling — such as changing colors based on the map style. /cc @fabian-guerra |
|
Anything moving on this? |
|
Not right now. Need to redo it. |
5d60096 to
971886f
Compare
|
I updated this branch and fixed the remaining issues.
|
971886f to
d9ee9b0
Compare
|
Squashed this but tried to preserve the version in #50 (comment) via 3a06ac8, which has the heading indicator placed on the outside and could be useful to reference sometime in the future. |
d9ee9b0 to
1b96d85
Compare


No description provided.