Get center coordinates on map drag event #3194
Unanswered
Reshad-Hasan
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to replicate how uber set position works where I want to drag the map and the marker position will be fixed
and when drag ends I should be able to get the location
I am trying to update the marker position when map bounds change with
handleBoundsChanged
(Initially map center and marker position is same)
but I can't get the map center after drag
I tried doing
const currentCenter = refMap.current.getInstance().getCenter();
but
currentCenter
always comesundefined
react-google-maps
gives getCenter directly from instance but I can't find anything like that in@react-google-maps/api
here is my full component code
how can I get the center position in onDrag or onBoundsChanged function?
Beta Was this translation helpful? Give feedback.
All reactions