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