I originally asked
this question over at stackoverflow, but no one could seem to answer it.
What I am trying to do is mimic the behavior for a google "My Places" feature. When editing a map, there are 3 icons at the top: a hand, a placemarker, and a lines/shapes menu. When I click the placemarker icon, 2 things happen simultaneously:
1.) A marker is added to the map, and
2.) The marker immediately becomes draggable (moving my cursor moves the placemarker).
A second click drops the marker onto the page.
What I cannot seem to do is combine the marker add & begin drag into a single mouse click. In my code, there are 3 clicks needed to add & place a marker:
1.) Click #1 adds the marker to the map
2.) Click #2 (mouse down) begins drag, and
3.) Click #3 (mouse up) stops the drag, dropping the marker in the cursor location.
How would one go about combining the marker add & begin drag into a single click? I could probably write custom javascript to make the marker follow the mouse cursor immediately after it is added, and stopping after the second click (to drop). I thought I would ask here first though, in case there is an easier way I am missing.
Thanks,
Dan