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

Annotation view implicit animation#5550

Merged
1ec5 merged 4 commits into
release-ios-v3.3.0from
1ec5-annotation-animation-5230
Jul 3, 2016
Merged

Annotation view implicit animation#5550
1ec5 merged 4 commits into
release-ios-v3.3.0from
1ec5-annotation-animation-5230

Conversation

@1ec5
Copy link
Copy Markdown
Contributor

@1ec5 1ec5 commented Jul 3, 2016

This PR is a subset of #5245 that focuses on improving KVO compliance and animation in MGLAnnotationView:

  • Fixed a bug causing an annotation view to be scaled based on a pitch of 0° when setting the view’s center offset.
  • Always reposition the annotation view using the standard -setCenter: setter, fixing KVO compliance for the center key path and making the view behave more like a normal view. -setCenter: updates the transform by side effect, and it always starts from the identity transform to avoid surprises.
  • An annotation view moves immediately when you change its centerOffset or scalesWithViewingDistance property.
  • Made annotation views’ positions animatable. In iosapp, tapping the callout view of a D.C. fire hydrant annotation causes the annotation view to slide to the center of the screen, smoothly growing or shrinking when the map is tilted. The view still moves instantaneously with the map as you manipulate it with gestures, including when dragging the annotation. (Fixes MGLAnnotationView not update location immediately on setCoordinate: #5230.)
  • In iosapp, eliminated the center view of MBXAnnotationView in favor of applying a background color and border to the annotation view’s layer.

/cc @boundsj @frederoni @friedbunny

1ec5 added 4 commits July 2, 2016 21:00
Fixed a bug causing an annotation view to be scaled based on a pitch of 0° when setting the view’s center offset.
Always reposition the annotation view using the standard -setCenter: setter, fixing KVO compliance for the center key path and making the view behave more like a normal view. -setCenter: updates the transform by side effect, and it always starts from the identity transform to avoid surprises. To apply a custom transform on an annotation view, make sure to apply it in -mapView:didFinishLoadingFrame:fullyRendered: based on the existing transform.
We don’t normally want an annotation view to animate its position, because that makes the view appear to lag behind the map. But when the annotation view moves due to the underlying annotation model object moving, the developer may want exactly that effect.

This change continues to disable the default implicit bounds (and now position) animation. It also groups the view updates in -updateAnnotationViews in a transaction that disables animation actions, to improve perceived performance with a large number of annotations. However, when the annotation model object changes, we move the annotation view outside of that transaction to allow the developer to opt into animation.

If the developer moreover wants the annotation view to animate even due to the viewport changing, they can override -setCenter: to use a UIView animation block.

Fixes #5230.
Eliminated the center view in favor of applying a background color and border to the annotation view’s layer.
@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage annotations Annotations on iOS and macOS or markers on Android labels Jul 3, 2016
@1ec5 1ec5 added this to the ios-v3.3.0 milestone Jul 3, 2016
@1ec5 1ec5 self-assigned this Jul 3, 2016
@1ec5 1ec5 changed the title 1ec5 annotation animation 5230 Annotation view implicit animation Jul 3, 2016
@1ec5 1ec5 merged commit 288b71b into release-ios-v3.3.0 Jul 3, 2016
@1ec5 1ec5 deleted the 1ec5-annotation-animation-5230 branch July 3, 2016 19:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

annotations Annotations on iOS and macOS or markers on Android bug iOS Mapbox Maps SDK for iOS performance Speed, stability, CPU usage, memory usage, or power usage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant