Prevent annotation changes from invalidating unrelated drag actions#1159
Open
TroyStopera wants to merge 1 commit intomapbox:masterfrom
Open
Prevent annotation changes from invalidating unrelated drag actions#1159TroyStopera wants to merge 1 commit intomapbox:masterfrom
TroyStopera wants to merge 1 commit intomapbox:masterfrom
Conversation
|
@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. |
Contributor
|
Tagging @mapbox/maps-android here. |
tobrun
approved these changes
May 27, 2021
Member
|
CI needs to be restored for this repo before we will be able to merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
DraggableAnnotationControllerwhich allows theAnnotationManagerto 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
Annotationclass which computes a 'drag integrity hash' which hashes all fields that must remain static during a drag. When a drag starts, theDraggableAnnotationManagercan 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.