Just wondering if it’s possible to limit a user to drawing only one rectangle using google maps drawing manager in google maps api. Ideally, the user would draw the rectangle, and the application would switch automatically to the pan tool which would allow the user to drag the handles of the rectangle around and edit its shape. The rectangle tool would be grayed out, and would not become available again until the user clicks a reset map button.
Share
Yes, this is possible. You would use the API to register an event listener for the
DrawingManager‘srectanglecompleteevent. Once that event fires, you can disable the control via theDrawingManagerOptions(specifically thedrawingControlproperty). You could easily re-enable the tool by switching thedrawingControlproperty to true when a user clicks on a reset button.Documentation here:
http://goo.gl/8zl7r