-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
Setting this property to YES will cause the annotation to shrink as it approaches the horizon and grow as it moves away from the | ||
horizon when the associated map view is tilted. | ||
*/ | ||
@property (nonatomic, assign, getter=isScaled) BOOL scaled; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
“Scaling” happens for a lot of reasons on iOS. This property should be more descriptively named so that people don’t expect it to relate to the device’s pixel ratio or UIImage.scale
somehow. Maybe scalesWithViewingDistance
or something?
224bc15
to
c6ae08c
Compare
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
@param reuseIdentifier The string that identifies that this annotation view is reusable. | |||
@return The initialized annotation view object or `nil` if there was a problem initializing the object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return type isn’t marked nullable
. I realize the MKAnnotationView documentation also indicates that nil
can be returned, but I think that’s a holdover from the old days before nullability was a concept in Objective-C. Is this view that much more likely to fail to initialize than an ordinary UIView?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree and thanks for helping me understand this a bit better. I'm going to remove the confusing language in the comment. Seems like MK and older MB code needs some additional comment cleaning (i.e. https://github.com/mapbox/mapbox-gl-native/blob/master/platform/ios/src/MGLAnnotationImage.h#L17)
👍 |
This adds an option to MGLAnnotationView so that a developer can control how their annotation views scale in size as they approach the top of the map view (along the Y axis). The size change is also affected by the pitch (tilt) of the map view. If there is no tilt then scaling is not performed. As the map is tilted scaling is gradually applied. This turns the MGLAnnotationView implementation into an Objective C++ class so that SDK constants from C++ files can be used. The new behavior is enabled by default to maintain consistency with annotations backed by GL sprites. The MBXViewController redundantly sets the new property as an illustration of use.
c6ae08c
to
4b3c26b
Compare
Fixes #5040
cc @1ec5 @friedbunny