Open TroyStopera opened 4 years ago
@LukasPaczos Note sure what I need to do to get eyes on this. I'd really like to get this working in master, so that I can update to the latest versions released by Mapbox.
Tagging @mapbox/maps-android here.
CI needs to be restored for this repo before we will be able to merge
Relates to, but does not resolve, #1029
Motivation for change
I have a use case where markers on the map are 'linked' together via lines. As the user drags a marker, it is necessary that the line is programmatically updated as well. Due to the current logic which ensures data integrity, updates to the associated lines invalidate/stop the drag action.
This simple change adds a new method to the
DraggableAnnotationController
which allows theAnnotationManager
to notify the controller of more fine-grain changes to the map source. If the change wasn't to the dragged annotation, the drag will continue.Future work
As stated above, this does not solve 1029, which asks that changes to certain attributes of a dragged annotation don't stop the drag action. For example, a circle should be able to change size while being dragged, as this does not logically interfere with the annotation moving.
Although not included in this PR, a solution to that could be to add a field/method to the
Annotation
class which computes a 'drag integrity hash' which hashes all fields that must remain static during a drag. When a drag starts, theDraggableAnnotationManager
can take note of this hash. When notified of an update, the controller can check the current integrity hash of the annotation, and if it doesn't match the original stop the drag.If that solution is agreeable, I can update this PR to include that.