-
Notifications
You must be signed in to change notification settings - Fork 1.3k
MGLPolygon, MGLPolyline coordinates should be mutable #6160
Comments
@ryanbaumann Currently scoping this out. Draggable is a different, higher-level issue and would likely be as equally complex as the mutation part, but could also be implemented in a custom way by any SDK users. |
This looks to be fairly straightforward—messy proof of concept done, which continually updates an Did this by way of a temporary The right way to do this is KVO in Stay tuned—should finish this completely today or tomorrow. |
PR for this ready for review in #6565. |
Just as it’s very convenient to be able to change an MGLPointAnnotation’s
coordinate
property and have the annotation move on the fly, it should be possible to change the shape of an MGLPolygon or MGLPolyline. This would be useful for GPS and fitness tracking applications as well as applications that allow the user to trace features over the map.MGLMultiPoint has a
coordinates
property that – due to Objective-C language limitations – holds a C array of CLLocationCoordinate2Ds, rather than an NSArray that we’d easily be able to make mutable. Nonetheless, we could pair this property with one that holds an NSMutableArray of NSValues representing CLLocationCoordinate2Ds, then implement all the to-many getters and setters expected by KVO. Alternatively, we could add a-setCoordinates:range:
method. Either approach will be somewhat messy in Objective-C and even messier when bridged to Swift.This is the iOS/macOS equivalent of #5224 on Android. I consider this feature blocked by #5844. The awkwardness of the API we’d add would outweigh any benefits to implementing a stopgap API like in #5848 on Android.
/cc @incanus @pveugen
The text was updated successfully, but these errors were encountered: