Commit Graph

6 Commits

Author SHA1 Message Date
Minh Nguyễn
288b71b671 [ios] Simplified MBXAnnotationView
Eliminated the center view in favor of applying a background color and border to the annotation view’s layer.
2016-07-02 21:00:48 -07:00
Minh Nguyễn
bb2f627b12 [ios] Made annotation view position animatable
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.
2016-07-02 21:00:41 -07:00
Fredrik Karlsson
d29bef957f [ios] fixes #5036 draggable annotation views (#5373) 2016-06-24 19:42:20 +02:00
Fredrik Karlsson
a557e1e2c9 [ios] fixes #5127, #5128, #5130 added enabled and selected property to MGLAnnotationView (#5297)
[ios] fixes #5127, #5128, #5130 added enabled and selected property to MGLAnnotationView
2016-06-14 10:36:41 +02:00
Jesse Bounds
d9c6181f34 [ios] Add annotation container view (#5194)
Add a container view to hold annotations. This gets around a performance
issue with `UIView:addSubview:` where adding views is N^2. It helps
annotation views avoid cutting into callout views when the annotation
views are transformed to be "flat".
2016-06-01 17:36:07 -07:00
Jesse Bounds
39669243b7 [ios] Introduce MGLAnnotationView and support for view annotations
Add an UIView subclass that can be used as the base class for all
client provided UIViews for annotations.

Teach MGLMapView to be able to display annotation views over the map if provided by the client delegate. For now, if the delegate provides a UIView then it will be used. If not, the map view will fall back to the old strategy of using GL annotations with an image provided by the delegate or a default image if not.
The map keeps a reuse queue and will store annotation views that are panned
offscreen in the queue if the application developer supplied a reuse queue identifer. The views in the queue are reused when more annotation
views are required. This view reuse provides a performance gain when many
annotations are shown and most of them are offscreen.

iosapp now implements the new delegate method to supply
a native view.

Add a playground to the workspace to facilitate experimentation
with new features. A playground is capable of importing frameworks if it
exists in the same workspace that builds the imported framework. The
initial playground demonstrates annotation views.

This also fixes a crash due to nullptr in annotations array If the `annotations` method is called while the user dot's callout view was showing, the userdot annotation is represented as null in the annotation context map. This
caused a crash when the null pointer was attempted to be converted
into an NSArray via C array. This protects against this bug by filtering out such a null annotation.
2016-05-13 15:51:40 -07:00