简体   繁体   中英

How to move marker with mouse move on google maps?

How to move marker with mouse move in this example?

http://www.geocodezip.com/v3_animate_marker_directions.html

Here marker is automatically animated after 50 ms but i want to move marker with mouse move on map.

Any idea on how to achieve it?

Markers movement is done in startAnimation() and animate() functions. So, instead of calling setTimeout() you have to do it manually, I imagine with mouse event handlers connected to marker. For each mouse move you have to do similar processing. There is step 50 m but moving mouse you will have to calculate step and pan the map.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM