UNPKG

34.2 kBTypeScriptView Raw
1declare namespace google.maps {
2 interface MapHandlerMap {
3 /**
4 * This event is fired when the viewport bounds have changed.
5 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.bounds_changed Maps JavaScript API}
6 * @see {@link Map#getBounds}
7 * @see {@link Map#fitBounds}
8 * @see {@link Map#panToBounds}
9 */
10 bounds_changed: [];
11
12 /**
13 * This event is fired when the map center property changes.
14 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.center_changed Maps JavaScript API}
15 * @see {@link MapOptions#center}
16 * @see {@link Map#getCenter}
17 * @see {@link Map#setCenter}
18 */
19 center_changed: [];
20
21 /**
22 * This event is fired when the user clicks on the map.
23 * An ApiMouseEvent with properties for the clicked location is returned unless a place icon was clicked, in which case an IconMouseEvent with a placeid is returned.
24 * IconMouseEvent and ApiMouseEvent are identical, except that IconMouseEvent has the placeid field.
25 * The event can always be treated as an ApiMouseEvent when the placeid is not important.
26 * The click event is not fired if a marker or infowindow was clicked.
27 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.click Maps JavaScript API}
28 */
29 click: [MouseEvent | IconMouseEvent];
30
31 /**
32 * This event is fired when the user double-clicks on the map. Note that the click event will also fire, right before this one.
33 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.dblclick Maps JavaScript API}
34 */
35 dblclick: [MouseEvent];
36
37 /**
38 * This event is repeatedly fired while the user drags the map.
39 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.drag Maps JavaScript API}
40 */
41 drag: [];
42
43 /**
44 * This event is fired when the user stops dragging the map.
45 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.dragend Maps JavaScript API}
46 */
47 dragend: [];
48
49 /**
50 * This event is fired when the user starts dragging the map.
51 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.dragstart Maps JavaScript API}
52 */
53 dragstart: [];
54
55 /**
56 * This event is fired when the map heading property changes.
57 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.heading_changed Maps JavaScript API}
58 * @see {@link MapOptions#heading}
59 * @see {@link Map#getHeading}
60 * @see {@link Map#setHeading}
61 */
62 heading_changed: [];
63
64 /**
65 * This event is fired when the map becomes idle after panning or zooming.
66 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.idle Maps JavaScript API}
67 */
68 idle: [];
69
70 /**
71 * This event is fired when the mapTypeId property changes.
72 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.maptypeid_changed Maps JavaScript API}
73 * @see {@link MapOptions#mapTypeId}
74 * @see {@link Map#getMapTypeId}
75 * @see {@link Map#setMapTypeId}
76 */
77 maptypeid_changed: [];
78
79 /**
80 * This event is fired whenever the user's mouse moves over the map container.
81 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.mousemove Maps JavaScript API}
82 */
83 mousemove: [MouseEvent];
84
85 /**
86 * This event is fired when the user's mouse exits the map container.
87 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.mouseout Maps JavaScript API}
88 */
89 mouseout: [MouseEvent];
90
91 /**
92 * This event is fired when the user's mouse enters the map container.
93 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.mouseover Maps JavaScript API}
94 */
95 mouseover: [MouseEvent];
96
97 /**
98 * This event is fired when the projection has changed.
99 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.projection_changed Maps JavaScript API}
100 * @see {@link Map#getProjection}
101 */
102 projection_changed: [];
103
104 /**
105 * This event is fired when the DOM contextmenu event is fired on the map container.
106 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.rightclick Maps JavaScript API}
107 */
108 rightclick: [MouseEvent];
109
110 /**
111 * This event is fired when the visible tiles have finished loading.
112 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.tilesloaded Maps JavaScript API}
113 */
114 tilesloaded: [];
115
116 /**
117 * This event is fired when the map tilt property changes.
118 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.tilt_changed Maps JavaScript API}
119 * @see {@link MapOptions#tilt}
120 * @see {@link Map#getTilt}
121 * @see {@link Map#setTilt}
122 */
123 tilt_changed: [];
124
125 /**
126 * This event is fired when the map zoom property changes.
127 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.zoom_changed Maps JavaScript API}
128 * @see {@link MapOptions#zoom}
129 * @see {@link Map#getZoom}
130 * @see {@link Map#setZoom}
131 */
132 zoom_changed: [];
133 }
134
135 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map Maps JavaScript API} */
136 class Map<E extends Element = Element> extends MVCObject {
137 /**
138 * Creates a new map inside of the given HTML container, which is typically a DIV element.
139 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.constructor Maps JavaScript API}
140 */
141 constructor(mapDiv: E, opts?: MapOptions);
142
143 /**
144 * @see {@link MapHandlerMap#bounds_changed bounds_changed} event
145 * @see {@link MapHandlerMap#center_changed center_changed} event
146 * @see {@link MapHandlerMap#click click} event
147 * @see {@link MapHandlerMap#dblclick dblclick} event
148 * @see {@link MapHandlerMap#drag drag} event
149 * @see {@link MapHandlerMap#dragend dragend} event
150 * @see {@link MapHandlerMap#dragstart dragstart} event
151 * @see {@link MapHandlerMap#heading_changed heading_changed} event
152 * @see {@link MapHandlerMap#idle idle} event
153 * @see {@link MapHandlerMap#maptypeid_changed maptypeid_changed} event
154 * @see {@link MapHandlerMap#mousemove mousemove} event
155 * @see {@link MapHandlerMap#mouseout mouseout} event
156 * @see {@link MapHandlerMap#mouseover mouseover} event
157 * @see {@link MapHandlerMap#projection_changed projection_changed} event
158 * @see {@link MapHandlerMap#rightclick rightclick} event
159 * @see {@link MapHandlerMap#tilesloaded tilesloaded} event
160 * @see {@link MapHandlerMap#tilt_changed tilt_changed} event
161 * @see {@link MapHandlerMap#zoom_changed zoom_changed} event
162 */
163 addListener<N extends keyof MapHandlerMap>(
164 eventName: N,
165 handler: MVCEventHandler<this, MapHandlerMap[N]>,
166 ): MapsEventListener;
167
168 /** @deprecated */
169 addListener(eventName: string, handler: MVCEventHandler<this, any[]>): MapsEventListener;
170
171 /**
172 * Sets the viewport to contain the given bounds.
173 * Note: When the map is set to `display: none`, the `fitBounds` function reads the map's size as 0x0, and therefore does not do anything.
174 * To change the viewport while the map is hidden, set the map to `visibility: hidden`, thereby ensuring the map div has an actual size.
175 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.fitBounds Maps JavaScript API}
176 * @see {@link MapHandlerMap#bounds_changed event bounds_changed}
177 * @see {@link getBounds}
178 * @see {@link panBy}
179 * @see {@link panTo}
180 * @see {@link panToBounds}
181 * @see {@link setCenter}
182 */
183 fitBounds(bounds: LatLngBounds | LatLngBoundsLiteral, padding?: number | Padding): void;
184
185 /**
186 * Returns the lat/lng bounds of the current viewport.
187 * If more than one copy of the world is visible, the bounds range in longitude from -180 to 180 degrees inclusive.
188 * If the map is not yet initialized (i.e. the mapType is still null), or center and zoom have not been set then the result is `null` or `undefined`.
189 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getBounds Maps JavaScript API}
190 * @see {@link MapHandlerMap#bounds_changed bounds_changed} event
191 * @see {@link fitBounds}
192 * @see {@link getCenter}
193 * @see {@link panToBounds}
194 */
195 getBounds(): LatLngBounds | null | undefined;
196
197 /**
198 * Returns the position displayed at the center of the map.
199 * Note that this {@link LatLng} object is not wrapped.
200 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getCenter Maps JavaScript API}
201 * @see {@link MapOptions#center}
202 * @see {@link MapHandlerMap#center_changed center_changed} event
203 * @see {@link getBounds}
204 * @see {@link setCenter}
205 */
206 getCenter(): LatLng;
207
208 /**
209 * Returns the clickability of the map icons.
210 * A map icon represents a point of interest, also known as a POI.
211 * If the returned value is true, then the icons are clickable on the map.
212 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getClickableIcons Maps JavaScript API}
213 * @see {@link MapOptions#clickableIcons}
214 * @see {@link setClickableIcons}
215 */
216 getClickableIcons(): boolean;
217
218 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getDiv Maps JavaScript API} */
219 getDiv(): E;
220
221 /**
222 * Returns the compass heading of aerial imagery.
223 * The heading value is measured in degrees (clockwise) from cardinal direction North.
224 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getHeading Maps JavaScript API}
225 * @see {@link MapOptions#heading}
226 * @see {@link MapHandlerMap#heading_changed heading_changed} event
227 * @see {@link setHeading}
228 */
229 getHeading(): number;
230
231 /**
232 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getMapTypeId Maps JavaScript API}
233 * @see {@link MapOptions#mapTypeId}
234 * @see {@link MapHandlerMap#maptypeid_changed maptypeid_changed} event
235 * @see {@link setMapTypeId}
236 * @see {@link mapTypes}
237 * @see {@link overlayMapTypes}
238 */
239 getMapTypeId(): MapTypeId;
240
241 /**
242 * If the map is not yet initialized (i.e. the mapType is still `null`) then the result is `null`.
243 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getProjection Maps JavaScript API}
244 * @see {@link MapHandlerMap#projection_changed projection_changed} event
245 */
246 getProjection(): Projection | null;
247
248 /**
249 * Returns the default {@link StreetViewPanorama} bound to the map, which may be a default panorama embedded within the map, or the panorama set using {@link setStreetView}().
250 * Changes to the map's {@link MapOptions#streetViewControl streetViewControl} will be reflected in the display of such a bound panorama.
251 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getStreetView Maps JavaScript API}
252 * @see {@link MapOptions#streetView}
253 * @see {@link setStreetView}
254 */
255 getStreetView(): StreetViewPanorama;
256
257 /**
258 * Returns the current angle of incidence of the map, in degrees from the viewport plane to the map plane.
259 * The result will be 0 for imagery taken directly overhead or 45 for 45° imagery.
260 * 45° imagery is only available for satellite and hybrid map types, within some locations, and at some zoom levels.
261 * Note: This method does not return the value set by setTilt. See setTilt for details.
262 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getTilt Maps JavaScript API}
263 * @see {@link MapOptions#tilt}
264 * @see {@link MapHandlerMap#tilt_changed tilt_changed} event
265 * @see {@link setTilt}
266 */
267 getTilt(): number;
268
269 /**
270 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.getZoom Maps JavaScript API}
271 * @see {@link MapOptions#zoom}
272 * @see {@link MapHandlerMap#zoom_changed zoom_changed} event
273 * @see {@link getBounds}
274 * @see {@link setZoom}
275 */
276 getZoom(): number;
277
278 /**
279 * Changes the center of the map by the given distance in pixels.
280 * If the distance is less than both the width and height of the map, the transition will be smoothly animated.
281 * Note that the map coordinate system increases from west to east (for x values) and north to south (for y values).
282 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.panBy Maps JavaScript API}
283 * @see {@link panTo}
284 * @see {@link panToBounds}
285 * @see {@link setCenter}
286 */
287 panBy(x: number, y: number): void;
288
289 /**
290 * Changes the center of the map to the given {@link LatLng}.
291 * If the change is less than both the width and height of the map, the transition will be smoothly animated.
292 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.panTo Maps JavaScript API}
293 * @see {@link panBy}
294 * @see {@link panToBounds}
295 * @see {@link setCenter}
296 */
297 panTo(latLng: LatLng | LatLngLiteral): void;
298
299 /**
300 * Pans the map by the minimum amount necessary to contain the given {@link LatLngBounds}.
301 * It makes no guarantee where on the map the bounds will be,
302 * except that the map will be panned to show as much of the bounds as possible inside `{currentMapSizeInPx} - {padding}`.
303 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.panToBounds Maps JavaScript API}
304 * @see {@link panBy}
305 * @see {@link panTo}
306 * @see {@link setCenter}
307 */
308 panToBounds(latLngBounds: LatLngBounds | LatLngBoundsLiteral, padding?: number | Padding): void;
309
310 /**
311 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setCenter Maps JavaScript API}
312 * @see {@link MapOptions#center}
313 * @see {@link MapHandlerMap#center_changed center_changed} event
314 * @see {@link fitBounds}
315 * @see {@link getCenter}
316 * @see {@link panBy}
317 * @see {@link panTo}
318 * @see {@link panToBounds}
319 */
320 setCenter(latlng: LatLng | LatLngLiteral): void;
321
322 /**
323 * Sets the compass heading for aerial imagery measured in degrees from cardinal direction North.
324 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setHeading Maps JavaScript API}
325 * @see {@link MapOptions#heading}
326 * @see {@link MapHandlerMap#heading_changed} event
327 * @see {@link getHeading}
328 */
329 setHeading(heading: number): void;
330
331 /**
332 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setMapTypeId Maps JavaScript API}
333 * @see {@link MapOptions#mapTypeId}
334 * @see {@link MapHandlerMap#maptypeid_changed} event
335 * @see {@link getMapTypeId}
336 * @see {@link mapTypes}
337 * @see {@link overlayMapTypes}
338 */
339 setMapTypeId(mapTypeId: MapTypeId | string): void;
340
341 /** @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setOptions Maps JavaScript API} */
342 setOptions(options: MapOptions): void;
343
344 /**
345 * Binds a {@link StreetViewPanorama} to the map.
346 * This panorama overrides the default {@link StreetViewPanorama}, allowing the map to bind to an external panorama outside of the map.
347 * Setting the panorama to `null` binds the default embedded panorama back to the map.
348 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setStreetView Maps JavaScript API}
349 * @see {@link MapOptions#streetView}
350 * @see {@link getStreetView}
351 */
352 setStreetView(panorama: StreetViewPanorama | null): void;
353
354 /**
355 * Controls the automatic switching behavior for the angle of incidence of the map.
356 * The only allowed values are `0` and `45`.
357 * `setTilt(0)` causes the map to always use a 0° overhead view regardless of the zoom level and viewport.
358 * `setTilt(45)` causes the tilt angle to automatically switch to 45 whenever 45° imagery is available for the current zoom level and viewport,
359 * and switch back to 0 whenever 45° imagery is not available (this is the default behavior).
360 * 45° imagery is only available for {@link MapTypeId.SATELLITE satellite} and {@link MapTypeId.HYBRID hybrid} map types, within some locations, and at some zoom levels.
361 * Note: getTilt returns the current tilt angle, not the value set by `setTilt`.
362 * Because getTilt and setTilt refer to different things, do not `bind`() the `tilt` property; doing so may yield unpredictable effects.
363 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setTilt Maps JavaScript API}
364 * @see {@link MapOptions#tilt}
365 * @see {@link MapHandlerMap#tilt_changed}
366 * @see {@link getTilt}
367 */
368 setTilt(tilt: number): void;
369
370 /**
371 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setZoom Maps JavaScript API}
372 * @see {@link MapOptions#zoom}
373 * @see {@link MapHandlerMap#zoom_changed zoom_changed} event
374 * @see {@link fitBounds}
375 * @see {@link getZoom}
376 * @see {@link panToBounds}
377 */
378 setZoom(zoom: number): void;
379
380 /**
381 * Additional controls to attach to the map.
382 * To add a control to the map, add the control's `<div>` to the {@link MVCArray} corresponding to the {@link ControlPosition} where it should be rendered.
383 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.controls Maps JavaScript API}
384 */
385 controls: Array<MVCArray<Node>>;
386
387 /**
388 * An instance of {@link Data}, bound to the map.
389 * Add features to this Data object to conveniently display them on this map.
390 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.data Maps JavaScript API}
391 */
392 data: Data;
393
394 /**
395 * A registry of {@link MapType} instances by string ID.
396 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.mapTypes Maps JavaScript API}
397 */
398 mapTypes: MapTypeRegistry;
399
400 /**
401 * Additional map types to overlay.
402 * Overlay map types will display on top of the base map they are attached to, in the order in which they appear in the
403 * `overlayMapTypes` array (overlays with higher index values are displayed in front of overlays with lower index values).
404 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.overlayMapTypes Maps JavaScript API}
405 */
406 overlayMapTypes: MVCArray<MapType>;
407
408 /**
409 * Controls whether the map icons are clickable or not. A map icon represents a point of interest, also known as a POI.
410 * To disable the clickability of map icons, pass a value of `false` to this method.
411 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#Map.setClickableIcons Maps JavaScript API}
412 * @see {@link MapOptions#clickableIcons}
413 * @see {@link getClickableIcons}
414 */
415 setClickableIcons(clickable: boolean): void;
416 }
417
418 type GestureHandlingOptions = 'cooperative' | 'greedy' | 'none' | 'auto';
419
420 interface MapOptions {
421 /**
422 * Color used for the background of the Map div. This color will be visible
423 * when tiles have not yet loaded as the user pans. This option can only be
424 * set when the map is initialized.
425 */
426 backgroundColor?: string;
427 /** The initial Map center. Required. */
428 center?: LatLng | LatLngLiteral;
429 /**
430 * When false, map icons are not clickable. A map icon represents a point of
431 * interest, also known as a POI. By default map icons are clickable.
432 */
433 clickableIcons?: boolean;
434 /**
435 * Size in pixels of the controls appearing on the map. This value must be
436 * supplied directly when creating the Map, updating this value later may
437 * bring the controls into an undefined state. Only governs the controls
438 * made by the Maps API itself. Does not scale developer created custom
439 * controls.
440 */
441 controlSize?: number;
442 /** Enables/disables all default UI. May be overridden individually. */
443 disableDefaultUI?: boolean;
444 /** Enables/disables zoom and center on double click. Enabled by default. */
445 disableDoubleClickZoom?: boolean;
446 /**
447 * If false, prevents the map from being dragged. Dragging is enabled by
448 * default.
449 */
450 draggable?: boolean;
451 /**
452 * The name or url of the cursor to display when mousing over a draggable
453 * map. This property uses the css cursor attribute to change the icon. As
454 * with the css property, you must specify at least one fallback cursor that
455 * is not a URL. For example: draggableCursor:
456 * 'url(http://www.example.com/icon.png), auto;'.
457 */
458 draggableCursor?: string;
459 /**
460 * The name or url of the cursor to display when the map is being dragged.
461 * This property uses the css cursor attribute to change the icon. As with
462 * the css property, you must specify at least one fallback cursor that is
463 * not a URL. For example: draggingCursor:
464 * 'url(http://www.example.com/icon.png), auto;'.
465 */
466 draggingCursor?: string;
467 /** The enabled/disabled state of the Fullscreen control. */
468 fullscreenControl?: boolean;
469 /** The display options for the Fullscreen control. */
470 fullscreenControlOptions?: FullscreenControlOptions;
471 /**
472 * This setting controls how gestures on the map are handled.
473 */
474 gestureHandling?: GestureHandlingOptions;
475 /**
476 * The heading for aerial imagery in degrees measured clockwise from
477 * cardinal direction North. Headings are snapped to the nearest available
478 * angle for which imagery is available.
479 */
480 heading?: number;
481 /**
482 * If false, prevents the map from being controlled by the keyboard.
483 * Keyboard shortcuts are enabled by default.
484 */
485 keyboardShortcuts?: boolean;
486 /** The initial enabled/disabled state of the Map type control. */
487 mapTypeControl?: boolean;
488 /** The initial display options for the Map type control. */
489 mapTypeControlOptions?: MapTypeControlOptions;
490 /** The initial Map mapTypeId. Defaults to ROADMAP. */
491 mapTypeId?: MapTypeId | string;
492 /**
493 * The maximum zoom level which will be displayed on the map. If omitted, or
494 * set to null, the maximum zoom from the current map type is used instead.
495 * Valid values: Integers between zero, and up to the supported maximum zoom
496 * level.
497 */
498 maxZoom?: number;
499 /**
500 * The minimum zoom level which will be displayed on the map. If omitted, or
501 * set to null, the minimum zoom from the current map type is used instead.
502 * Valid values: Integers between zero, and up to the supported maximum zoom
503 * level.
504 */
505 minZoom?: number;
506 /** If true, do not clear the contents of the Map div. */
507 noClear?: boolean;
508 /**
509 * The enabled/disabled state of the Pan control.
510 * Note: The Pan control is not available in the new set of controls
511 * introduced in v3.22 of the Google Maps JavaScript API. While using v3.22
512 * and v3.23, you can choose to use the earlier set of controls rather than
513 * the new controls, thus making the Pan control available as part of the
514 * old control set. See {@link
515 * https://developers.google.com/maps/articles/v322-controls-diff|What's New
516 * in the v3.22 Map Controls}.
517 */
518 panControl?: boolean;
519 /**
520 * The display options for the Pan control.
521 * Note: The Pan control is not available in the new set of controls
522 * introduced in v3.22 of the Google Maps JavaScript API. While using v3.22
523 * and v3.23, you can choose to use the earlier set of controls rather than
524 * the new controls, thus making the Pan control available as part of the
525 * old control set. See {@link
526 * https://developers.google.com/maps/articles/v322-controls-diff|What's New
527 * in the v3.22 Map Controls}.
528 */
529 panControlOptions?: PanControlOptions;
530 /**
531 * Defines a boundary that restricts the area of the map accessible to users.
532 * When set, a user can only pan and zoom while the camera view stays inside the
533 * limits of the boundary.
534 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapOptions.restriction Maps JavaScript API}
535 */
536 restriction?: MapRestriction;
537 /** The enabled/disabled state of the Rotate control. */
538 rotateControl?: boolean;
539 /** The display options for the Rotate control. */
540 rotateControlOptions?: RotateControlOptions;
541 /** The initial enabled/disabled state of the Scale control. */
542 scaleControl?: boolean;
543 /** The initial display options for the Scale control. */
544 scaleControlOptions?: ScaleControlOptions;
545 /**
546 * If false, disables scrollwheel zooming on the map. The scrollwheel is
547 * enabled by default.
548 */
549 scrollwheel?: boolean;
550 /**
551 * A StreetViewPanorama to display when the Street View pegman is dropped on
552 * the map. If no panorama is specified, a default StreetViewPanorama will
553 * be displayed in the map's div when the pegman is dropped.
554 */
555 streetView?: StreetViewPanorama;
556 /**
557 * The initial enabled/disabled state of the Street View Pegman control.
558 * This control is part of the default UI, and should be set to false when
559 * displaying a map type on which the Street View road overlay should not
560 * appear (e.g. a non-Earth map type).
561 */
562 streetViewControl?: boolean;
563 /** The initial display options for the Street View Pegman control. */
564 streetViewControlOptions?: StreetViewControlOptions;
565 /**
566 * Styles to apply to each of the default map types. Note that for
567 * satellite/hybrid and terrain modes, these styles will only apply to
568 * labels and geometry.
569 */
570 styles?: MapTypeStyle[];
571 /**
572 * Controls the automatic switching behavior for the angle of incidence of
573 * the map. The only allowed values are 0 and 45. The value 0 causes the map
574 * to always use a 0° overhead view regardless of the zoom level and
575 * viewport. The value 45 causes the tilt angle to automatically switch to
576 * 45 whenever 45° imagery is available for the current zoom level and
577 * viewport, and switch back to 0 whenever 45° imagery is not available
578 * (this is the default behavior). 45° imagery is only available for
579 * satellite and hybrid map types, within some locations, and at some zoom
580 * levels. Note: getTilt returns the current tilt angle, not the value
581 * specified by this option. Because getTilt and this option refer to
582 * different things, do not bind() the tilt property; doing so may yield
583 * unpredictable effects.
584 */
585 tilt?: number;
586 /**
587 * The initial Map zoom level. Required. Valid values: Integers between
588 * zero, and up to the supported maximum zoom level.
589 */
590 zoom?: number;
591 /** The enabled/disabled state of the Zoom control. */
592 zoomControl?: boolean;
593 /** The display options for the Zoom control. */
594 zoomControlOptions?: ZoomControlOptions;
595 }
596
597 interface MapTypeStyle {
598 elementType?: MapTypeStyleElementType;
599 featureType?: MapTypeStyleFeatureType;
600 stylers?: MapTypeStyler[];
601 }
602
603 /**
604 * This object is returned from various mouse events on the map and overlays,
605 * and contains all the fields shown below.
606 */
607 interface MouseEvent {
608 /** Prevents this event from propagating further. */
609 stop(): void;
610 /**
611 * The latitude/longitude that was below the cursor when the event
612 * occurred.
613 */
614 latLng: LatLng;
615 }
616
617 /**
618 * This object is sent in an event when a user clicks on an icon on the map.
619 * The place ID of this place is stored in the placeId member.
620 * To prevent the default info window from showing up, call the stop() method
621 * on this event to prevent it being propagated. Learn more about place IDs in
622 * the Places API developer guide.
623 */
624 interface IconMouseEvent extends MouseEvent {
625 /**
626 * The place ID of the place that was clicked.
627 * This place ID can be used to query more information about the feature
628 * that was clicked.
629 */
630 placeId: string;
631 }
632
633 /**
634 * Identifiers for common MapTypes. Specify these by value, or by using the
635 * constant's name. For example, 'satellite' or
636 * google.maps.MapTypeId.SATELLITE.
637 */
638 enum MapTypeId {
639 /** This map type displays a transparent layer of major streets on satellite images. */
640 HYBRID = 'hybrid',
641 /** This map type displays a normal street map. */
642 ROADMAP = 'roadmap',
643 /** This map type displays satellite images. */
644 SATELLITE = 'satellite',
645 /** This map type displays maps with physical features such as terrain and vegetation. */
646 TERRAIN = 'terrain',
647 }
648
649 class MapTypeRegistry extends MVCObject {
650 constructor();
651 set(id: string, mapType: MapType): void;
652 }
653
654 /**
655 * A restriction that can be applied to the Map. The map's viewport will not
656 * exceed these restrictions.
657 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction Maps JavaScript API}
658 */
659 interface MapRestriction {
660 /**
661 * When set, a user can only pan and zoom inside the given bounds.
662 * Bounds can restrict both longitude and latitude, or can restrict
663 * latitude only. For latitude-only bounds use west and east longitudes
664 * of -180 and 180, respectively.
665 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction.latLngBounds Maps JavaScript API}
666 */
667 latLngBounds: LatLngBounds | LatLngBoundsLiteral;
668 /**
669 * By default bounds are relaxed, meaning that a user can zoom out
670 * until the entire bounded area is in view. Bounds can be made more
671 * restrictive by setting the strictBounds flag to true. This reduces
672 * how far a user can zoom out, ensuring that everything outside of the
673 * restricted bounds stays hidden.
674 * @see {@link https://developers.google.com/maps/documentation/javascript/reference/map#MapRestriction.strictBounds Maps JavaScript API}
675 */
676 strictBounds?: boolean;
677 }
678
679 class TrafficLayer extends MVCObject {
680 constructor(opts?: TrafficLayerOptions);
681 getMap(): Map;
682 setMap(map: Map | null): void;
683 setOptions(options: TrafficLayerOptions): void;
684 }
685
686 interface TrafficLayerOptions {
687 autoRefresh?: boolean;
688 map?: Map;
689 }
690
691 class TransitLayer extends MVCObject {
692 constructor();
693 getMap(): void;
694 setMap(map: Map | null): void;
695 }
696
697 class BicyclingLayer extends MVCObject {
698 constructor();
699 getMap(): Map;
700 setMap(map: Map | null): void;
701 }
702}