How to disable drawing tools

975 views
Skip to first unread message

JML

unread,
Jan 24, 2012, 10:21:56 AM1/24/12
to Google Maps JavaScript API v3
Hi,

I'm using the drawing tools like in this example:
http://code.google.com/p/gmaps-samples-v3/source/browse/trunk/drawing/drawing-tools.html?r=282

I want to give user the opportunity to draw polygons and load stored
polygons from a database. I want to have only one polygon at one time
so I'd like to disable the "draw function" if there already is one
polygon on the map.

How can I achive this?

Thanks
JML

Enoch Lau (Google Employee)

unread,
Jan 24, 2012, 4:02:14 PM1/24/12
to google-map...@googlegroups.com
http://code.google.com/apis/maps/documentation/javascript/reference.html#DrawingControlOptions

You could set the drawing modes visible on the control to be an empty array; that way, the only control visible is the 'hand', that lets them pan the map.

Enoch

JML

unread,
Jan 25, 2012, 3:26:07 AM1/25/12
to Google Maps JavaScript API v3
How can I set the ooptions to an empty array? Can you give me an
example?

JML

unread,
Jan 25, 2012, 3:52:25 AM1/25/12
to Google Maps JavaScript API v3
This is how I did it:
drawingManager.setOptions({drawingControlOptions: {drawingModes: new
Array()}});

Is that the correct way?
Reply all
Reply to author
Forward
0 new messages