Adding markers like in MyMaps

Click a marker above map and move mouse on map.

follow() function is triggered.

Marker is created by 'mousemove' GEvent on map.

Turning flag noMore = true prevents more than one marker to be created.

'mousemove' returns GLatLng() point of cursor which moves the marker by .setLatLng() method.

Moving is stopped by 'click' GEvent on map.

Flag dog = false stops movement and the GEvent listeners are destroyed to save resources.

Marker is draggable and it is deleted by dragging off the map.

The script is at the bottom of the source code.

More experiments