You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Map instance with an onClick that sets the position of a marker to the latLng of the clicked position.
This marker is draggable, and onDragEnd shows an InfoWindow with the new position. The problem is that when onDragEnd ends the Map's onClick event fires. Both onClick and onDragEnd sets the position, but since they have a small difference this leads to the marker to jump to a close (but not exactly intended) position.
I expected the onClick event to not fire when AdvancedMarker onDragEnd fires.
I just ran into that same issue with a routes/directions feature. The onClick will add a marker, when there are 2 markers the directions service is kicked off. But when there is only 1 marker, and it is dragged, the onDragEnd updates marker 1 AND adds a second marker as the map onClick is fired.
The ugly workaround I'm using now is setting a isDragEvent ref true when the onDragEnd fires, and then in the onClick ignoring the event if the ref is true, and then setting it false. Don't love it but if this is how the maps api works don't see it getting "fixed" anytime soon.
Description
I have a Map instance with an onClick that sets the position of a marker to the latLng of the clicked position.
This marker is draggable, and onDragEnd shows an InfoWindow with the new position. The problem is that when onDragEnd ends the Map's onClick event fires. Both onClick and onDragEnd sets the position, but since they have a small difference this leads to the marker to jump to a close (but not exactly intended) position.
I expected the onClick event to not fire when AdvancedMarker onDragEnd fires.
Steps to Reproduce
Code SandBox:
SandBox
Steps:
Environment
Logs
No response
The text was updated successfully, but these errors were encountered: