Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] Add annotation view scaling #5085

Merged
merged 1 commit into from
May 27, 2016
Merged

Conversation

boundsj
Copy link
Contributor

@boundsj boundsj commented May 20, 2016

@boundsj boundsj added the iOS Mapbox Maps SDK for iOS label May 20, 2016
@boundsj boundsj added this to the ios-v3.3.0 milestone May 20, 2016
@boundsj boundsj self-assigned this May 20, 2016
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;
Copy link
Contributor

@1ec5 1ec5 May 20, 2016

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?

@@ -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.
Copy link
Contributor

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?

Copy link
Contributor Author

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)

@1ec5
Copy link
Contributor

1ec5 commented May 26, 2016

👍

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants