-
Has anyone had any success with dragging and dropping an existing Marker on the map in order to "move", i.e. relocate the marker? |
Beta Was this translation helpful? Give feedback.
Answered by
jnorvell
Sep 27, 2023
Replies: 2 comments
-
Here is a stackoverflow question that someone posted, but it is not reactjs or this library. https://stackoverflow.com/questions/5688745/google-maps-v3-draggable-marker |
Beta Was this translation helpful? Give feedback.
0 replies
-
I was able to get it to work using a couple of pieces:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
jnorvell
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was able to get it to work using a couple of pieces:
<Marker>
elements, add thedraggable={true}
property.ref={}
property, and notice how we can use the callback handler form, this way it passes the React component as thenode
parameter, and we can get a handle to the google maps Marker by referencing the.marker
property.dragend
event listener..getPosition()
and thenlat()
andlng()
to get the new values.