UNPKG

4.39 kBTypeScriptView Raw
1declare namespace google.maps.drawing {
2 class DrawingManager extends MVCObject {
3 constructor(options?: DrawingManagerOptions);
4 getDrawingMode(): OverlayType;
5 getMap(): Map;
6 setDrawingMode(drawingMode: OverlayType | null): void;
7 setMap(map: Map | null): void;
8 setOptions(options: DrawingManagerOptions): void;
9 }
10
11 /** Options for the drawing manager. */
12 interface DrawingManagerOptions {
13 /**
14 * Options to apply to any new circles created with this DrawingManager.
15 * The center and radius properties are ignored, and the map property of a
16 * new circle is always set to the DrawingManager's map.
17 */
18 circleOptions?: CircleOptions;
19 /**
20 * The enabled/disabled state of the drawing control. Defaults to true.
21 */
22 drawingControl?: boolean;
23 /** The display options for the drawing control. */
24 drawingControlOptions?: DrawingControlOptions;
25 /**
26 * The DrawingManager's drawing mode, which defines the type of overlay to
27 * be added on the map. Accepted values are 'marker', 'polygon',
28 * 'polyline', 'rectangle', 'circle', or null. A drawing mode of null
29 * means that the user can interact with the map as normal, and clicks do
30 * not draw anything.
31 */
32 drawingMode?: OverlayType | null;
33 /**
34 * The Map to which the DrawingManager is attached, which is the Map on
35 * which the overlays created will be placed.
36 */
37 map?: Map;
38 /**
39 * Options to apply to any new markers created with this DrawingManager.
40 * The position property is ignored, and the map property of a new marker
41 * is always set to the DrawingManager's map.
42 */
43 markerOptions?: MarkerOptions;
44 /**
45 * Options to apply to any new polygons created with this DrawingManager.
46 * The paths property is ignored, and the map property of a new polygon is
47 * always set to the DrawingManager's map.
48 */
49 polygonOptions?: PolygonOptions;
50 /**
51 * Options to apply to any new polylines created with this DrawingManager.
52 * The path property is ignored, and the map property of a new polyline is
53 * always set to the DrawingManager's map.
54 */
55 polylineOptions?: PolylineOptions;
56 /**
57 * Options to apply to any new rectangles created with this
58 * DrawingManager. The bounds property is ignored, and the map property of
59 * a new rectangle is always set to the DrawingManager's map.
60 */
61 rectangleOptions?: RectangleOptions;
62 }
63
64 interface DrawingControlOptions {
65 drawingModes?: OverlayType[];
66 position?: ControlPosition;
67 }
68
69 /** The properties of an overlaycomplete event on a DrawingManager.. */
70 interface OverlayCompleteEvent {
71 /** The completed overlay. */
72 overlay: Marker | Polygon | Polyline | Rectangle | Circle;
73 /** The completed overlay's type. */
74 type: OverlayType;
75 }
76
77 /**
78 * The types of overlay that may be created by the DrawingManager. Specify
79 * these by value, or by using the constant's name. For example, 'polygon'
80 * or google.maps.drawing.OverlayType.POLYGON.
81 */
82 enum OverlayType {
83 /**
84 * Specifies that the DrawingManager creates circles, and that the overlay
85 * given in the overlaycomplete event is a circle.
86 */
87 CIRCLE = 'circle',
88 /**
89 * Specifies that the DrawingManager creates markers, and that the overlay
90 * given in the overlaycomplete event is a marker.
91 */
92 MARKER = 'marker',
93 /**
94 * Specifies that the DrawingManager creates polygons, and that the
95 * overlay given in the overlaycomplete event is a polygon.
96 */
97 POLYGON = 'polygon',
98 /**
99 * Specifies that the DrawingManager creates polylines, and that the
100 * overlay given in the overlaycomplete event is a polyline.
101 */
102 POLYLINE = 'polyline',
103 /**
104 * Specifies that the DrawingManager creates rectangles, and that the
105 * overlay given in the overlaycomplete event is a rectangle.
106 */
107 RECTANGLE = 'rectangle',
108 }
109}