How to Create the Drop Pin function like on "My Places" ?

263 views
Skip to first unread message

chillsphere

unread,
Dec 15, 2011, 12:00:21 PM12/15/11
to Google Maps JavaScript API v3
Hi guys,

Hoping you can help - I'm trying to recreate my own mini version of
"My Places" where you can click on a "pin" button and then the
following happens :

1. The Mouse Cursor chagnes to a Pin graphic
2. The user then moves to cursor over the map to drop the pin with
"left-click" of the mouse
3. a pop-up infowindow appears allowing them to enter details about
the marker and save.


I'm pretty happy with completing items 2 and 3 but I just cannot work
out how to change the mouse cursor to the Pin.

Current research has suggested using "draggableCursor" OR adding a
custom class to the my map <div> that uses CSS to change the pointer.

Unfortunately - I cannot get this to work, does anyone know of a good
example I can look at? OR how I should approach this?

One thought has just crossed my mind... to create a marker itself and
somehow have it in a state where it remains draggable until the next
click of the mouse.

hmmm... any advice would be sincerely appreciated

Andy

Enoch Lau (Google Employee)

unread,
Dec 16, 2011, 1:52:52 AM12/16/11
to google-map...@googlegroups.com
DrawingManager allows you to provide your users with the ability to add new markers to the map by clicking on it. The mouse cursor doesn't change to be a marker as you describe it (it's a crosshair instead) but it is otherwise functionally the same as what you describe. To implement step 3, listen for a 'markercomplete' event on your DrawingManager object and show an info window in the event listener.

Enoch

sam

unread,
Dec 16, 2011, 1:56:08 AM12/16/11
to google-map...@googlegroups.com
can any body tell me how can i find the selected route index from suggested routes of google map using javascript

chillsphere

unread,
Dec 16, 2011, 9:54:57 AM12/16/11
to Google Maps JavaScript API v3
Thanks Enoch

That's tremendous, have not had a chance to fully look at the code -
but it is possible to change the cursor to a pin graphic using this
method?

cheers

andy


On Dec 16, 6:52 am, "Enoch Lau (Google Employee)"
<enoch...@google.com> wrote:
> DrawingManager<http://code.google.com/apis/maps/documentation/javascript/overlays.ht...>allows you to provide your users with the ability to add new markers to the

Enoch Lau (Google Employee)

unread,
Dec 17, 2011, 2:37:06 AM12/17/11
to google-map...@googlegroups.com
No it isn't possible to change the cursor. Feel free to file a feature request at http://code.google.com/p/gmaps-api-issues/issues/list if you'd like to be able to change it.

Enoch
Reply all
Reply to author
Forward
0 new messages