@@ -33,15 +33,6 @@ interface GoogleMapsWindow extends Window {
33
33
google ?: typeof google ;
34
34
}
35
35
36
- // TODO(mbehrlich): Update this to use original map after updating DefinitelyTyped
37
- /**
38
- * Extends the Google Map interface due to the Definitely Typed implementation
39
- * missing "getClickableIcons".
40
- */
41
- export interface UpdatedGoogleMap extends google . maps . Map {
42
- getClickableIcons : ( ) => boolean ;
43
- }
44
-
45
36
/** default options set to the Googleplex */
46
37
export const DEFAULT_OPTIONS : google . maps . MapOptions = {
47
38
center : { lat : 37.421995 , lng : - 122.084092 } ,
@@ -74,7 +65,13 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
74
65
private readonly _zoom = new BehaviorSubject < number | undefined > ( undefined ) ;
75
66
private readonly _destroy = new Subject < void > ( ) ;
76
67
private _mapEl : HTMLElement ;
77
- _googleMap : UpdatedGoogleMap ;
68
+
69
+ /**
70
+ * The underlying google.maps.Map object
71
+ *
72
+ * See developers.google.com/maps/documentation/javascript/reference/map#Map
73
+ */
74
+ googleMap ?: google . maps . Map ;
78
75
79
76
/** Whether we're currently rendering inside a browser. */
80
77
_isBrowser : boolean ;
@@ -257,8 +254,8 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
257
254
258
255
ngOnChanges ( ) {
259
256
this . _setSize ( ) ;
260
- if ( this . _googleMap && this . mapTypeId ) {
261
- this . _googleMap . setMapTypeId ( this . mapTypeId ) ;
257
+ if ( this . googleMap && this . mapTypeId ) {
258
+ this . googleMap . setMapTypeId ( this . mapTypeId ) ;
262
259
}
263
260
}
264
261
@@ -269,8 +266,8 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
269
266
this . _setSize ( ) ;
270
267
this . _googleMapChanges = this . _initializeMap ( this . _combineOptions ( ) ) ;
271
268
this . _googleMapChanges . subscribe ( ( googleMap : google . maps . Map ) => {
272
- this . _googleMap = googleMap as UpdatedGoogleMap ;
273
- this . _eventManager . setTarget ( this . _googleMap ) ;
269
+ this . googleMap = googleMap ;
270
+ this . _eventManager . setTarget ( this . googleMap ) ;
274
271
} ) ;
275
272
276
273
this . _watchForOptionsChanges ( ) ;
@@ -293,7 +290,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
293
290
bounds : google . maps . LatLngBounds | google . maps . LatLngBoundsLiteral ,
294
291
padding ?: number | google . maps . Padding ) {
295
292
this . _assertInitialized ( ) ;
296
- this . _googleMap . fitBounds ( bounds , padding ) ;
293
+ this . googleMap ! . fitBounds ( bounds , padding ) ;
297
294
}
298
295
299
296
/**
@@ -302,7 +299,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
302
299
*/
303
300
panBy ( x : number , y : number ) {
304
301
this . _assertInitialized ( ) ;
305
- this . _googleMap . panBy ( x , y ) ;
302
+ this . googleMap ! . panBy ( x , y ) ;
306
303
}
307
304
308
305
/**
@@ -311,7 +308,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
311
308
*/
312
309
panTo ( latLng : google . maps . LatLng | google . maps . LatLngLiteral ) {
313
310
this . _assertInitialized ( ) ;
314
- this . _googleMap . panTo ( latLng ) ;
311
+ this . googleMap ! . panTo ( latLng ) ;
315
312
}
316
313
317
314
/**
@@ -322,7 +319,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
322
319
latLngBounds : google . maps . LatLngBounds | google . maps . LatLngBoundsLiteral ,
323
320
padding ?: number | google . maps . Padding ) {
324
321
this . _assertInitialized ( ) ;
325
- this . _googleMap . panToBounds ( latLngBounds , padding ) ;
322
+ this . googleMap ! . panToBounds ( latLngBounds , padding ) ;
326
323
}
327
324
328
325
/**
@@ -331,7 +328,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
331
328
*/
332
329
getBounds ( ) : google . maps . LatLngBounds | null {
333
330
this . _assertInitialized ( ) ;
334
- return this . _googleMap . getBounds ( ) || null ;
331
+ return this . googleMap ! . getBounds ( ) || null ;
335
332
}
336
333
337
334
/**
@@ -340,7 +337,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
340
337
*/
341
338
getCenter ( ) : google . maps . LatLng {
342
339
this . _assertInitialized ( ) ;
343
- return this . _googleMap . getCenter ( ) ;
340
+ return this . googleMap ! . getCenter ( ) ;
344
341
}
345
342
346
343
/**
@@ -349,7 +346,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
349
346
*/
350
347
getClickableIcons ( ) : boolean {
351
348
this . _assertInitialized ( ) ;
352
- return this . _googleMap . getClickableIcons ( ) ;
349
+ return this . googleMap ! . getClickableIcons ( ) ;
353
350
}
354
351
355
352
/**
@@ -358,7 +355,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
358
355
*/
359
356
getHeading ( ) : number {
360
357
this . _assertInitialized ( ) ;
361
- return this . _googleMap . getHeading ( ) ;
358
+ return this . googleMap ! . getHeading ( ) ;
362
359
}
363
360
364
361
/**
@@ -367,7 +364,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
367
364
*/
368
365
getMapTypeId ( ) : google . maps . MapTypeId | string {
369
366
this . _assertInitialized ( ) ;
370
- return this . _googleMap . getMapTypeId ( ) ;
367
+ return this . googleMap ! . getMapTypeId ( ) ;
371
368
}
372
369
373
370
/**
@@ -376,7 +373,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
376
373
*/
377
374
getProjection ( ) : google . maps . Projection | null {
378
375
this . _assertInitialized ( ) ;
379
- return this . _googleMap . getProjection ( ) ;
376
+ return this . googleMap ! . getProjection ( ) ;
380
377
}
381
378
382
379
/**
@@ -385,7 +382,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
385
382
*/
386
383
getStreetView ( ) : google . maps . StreetViewPanorama {
387
384
this . _assertInitialized ( ) ;
388
- return this . _googleMap . getStreetView ( ) ;
385
+ return this . googleMap ! . getStreetView ( ) ;
389
386
}
390
387
391
388
/**
@@ -394,7 +391,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
394
391
*/
395
392
getTilt ( ) : number {
396
393
this . _assertInitialized ( ) ;
397
- return this . _googleMap . getTilt ( ) ;
394
+ return this . googleMap ! . getTilt ( ) ;
398
395
}
399
396
400
397
/**
@@ -403,7 +400,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
403
400
*/
404
401
getZoom ( ) : number {
405
402
this . _assertInitialized ( ) ;
406
- return this . _googleMap . getZoom ( ) ;
403
+ return this . googleMap ! . getZoom ( ) ;
407
404
}
408
405
409
406
/**
@@ -412,7 +409,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
412
409
*/
413
410
get controls ( ) : Array < google . maps . MVCArray < Node > > {
414
411
this . _assertInitialized ( ) ;
415
- return this . _googleMap . controls ;
412
+ return this . googleMap ! . controls ;
416
413
}
417
414
418
415
/**
@@ -421,7 +418,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
421
418
*/
422
419
get data ( ) : google . maps . Data {
423
420
this . _assertInitialized ( ) ;
424
- return this . _googleMap . data ;
421
+ return this . googleMap ! . data ;
425
422
}
426
423
427
424
/**
@@ -430,7 +427,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
430
427
*/
431
428
get mapTypes ( ) : google . maps . MapTypeRegistry {
432
429
this . _assertInitialized ( ) ;
433
- return this . _googleMap . mapTypes ;
430
+ return this . googleMap ! . mapTypes ;
434
431
}
435
432
436
433
/**
@@ -439,7 +436,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
439
436
*/
440
437
get overlayMapTypes ( ) : google . maps . MVCArray < google . maps . MapType > {
441
438
this . _assertInitialized ( ) ;
442
- return this . _googleMap . overlayMapTypes ;
439
+ return this . googleMap ! . overlayMapTypes ;
443
440
}
444
441
445
442
private _setSize ( ) {
@@ -507,7 +504,7 @@ export class GoogleMap implements OnChanges, OnInit, OnDestroy {
507
504
508
505
/** Asserts that the map has been initialized. */
509
506
private _assertInitialized ( ) {
510
- if ( ! this . _googleMap ) {
507
+ if ( ! this . googleMap ) {
511
508
throw Error ( 'Cannot access Google Map information before the API has been initialized. ' +
512
509
'Please wait for the API to load before trying to interact with it.' ) ;
513
510
}
0 commit comments