mapbox-plugins-android icon indicating copy to clipboard operation
mapbox-plugins-android copied to clipboard

Android animation cancels drag events on annotations

Open SalimHFX opened this issue 6 years ago • 6 comments

I'm using a CircleManager to handle a bunch of events such as click, long click, drag started, drag and drag finished. I am also using some android animations that do things such as periodically change the circles' radius.

Without the animations the drag events work just fine.

Now, with the animation process on, I can't drag my circles around. Using some traces I realized that the onAnnotationDragStarted event does get triggered when I try to move a circle. However, the onAnnotationDragFinished also instantly gets triggered right after the onAnnotationDragStarted.

Am I doing something work or is this expected behaviour ? If so, is there any workaround for it ? I'd very much like to be able to both animate and drag around my annotations.

Thank you

SalimHFX avatar Aug 06 '19 12:08 SalimHFX

This behavior is enforced to ensure the data sets integrity - for example, we need to make sure to stop dragging when an annotation is removed or its position changes programmatically. That said, we should be able to relax those constraints for other types of updates.

LukasPaczos avatar Aug 12 '19 14:08 LukasPaczos

I understand, thanks.

For anyone who might be facing the same issue, the workaround I found is simply to pause/resume the animation's Animator on onDragStarted/onDragFinished events.

SalimHFX avatar Aug 12 '19 14:08 SalimHFX

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] avatar Feb 08 '20 15:02 stale[bot]

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

stale[bot] avatar Feb 08 '20 16:02 stale[bot]

Any movement on this? Still running into this issue...

nickdonnellyriis avatar Sep 21 '20 12:09 nickdonnellyriis

I'm also interested in getting this resolved. I have lines on the map that are associated with markers, and when the marker drags, I need the line to move with it. Despite the fact that these are managed by different AnnotationManagers, the drag is still invalidated. Seems to be because there is only a single instance of the DraggableAnnotationController used by every manager, which I know is necessary

I'd like to investigate the constraints a bit more here and take a stab at getting this done myself.

@LukasPaczos is there a reason that any map update stops the drag, as opposed to just updates to the marker being dragged? It seems to me like checking to make sure the marker being dragged hasn't changed would be enough to safely continue the drag after a onSourceUpdated() call.

TroyStopera avatar Sep 24 '20 21:09 TroyStopera