Unable to drag the Map #475
Replies: 1 comment
-
The main problem seems to be I would suggest a few changes:
Here is a basic example of the mechanism: https://codesandbox.io/p/devbox/centered-marker-wnzg98?file=%2Fsrc%2Fapp.tsx%3A27%2C32&workspaceId=308f8424-7fda-45b9-be07-d27ae10b961b When keeping the pin centered this way you will however probably see a bit of jitter and/or tiny delay on the marker when moving the map. Another approach would be not to use a maps marker with lat/lng but to use just an image that is centered on top of the map/DOM container. This way it should be perfectly smooth and it will always be centered automatically when the map moves underneath. So the main point is: Move the geocoding out of the lat/lng update path for the controlled map component. |
Beta Was this translation helpful? Give feedback.
-
I want to achieve the Google Map where the marker remains centered, even when users drag or zoom in/out. However, currently, I'm unable to drag the map at all.
Beta Was this translation helpful? Give feedback.
All reactions