From 8f770f931c147c85a41c3413538c68f601e6ae63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Thu, 16 Jun 2016 15:28:21 +0200 Subject: [PATCH] feat(SebmGoogleMap): support streetViewControl opt Closes #418 --- src/core/directives/google-map.ts | 17 +++++++++++++---- src/core/services/google-maps-types.ts | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/core/directives/google-map.ts b/src/core/directives/google-map.ts index a924128a2..7155d917a 100644 --- a/src/core/directives/google-map.ts +++ b/src/core/directives/google-map.ts @@ -15,7 +15,7 @@ import {MarkerManager} from '../services/marker-manager'; * * ### Example * ```typescript - * import {Component} from 'angular2/core'; + * import {Component} from '@angular/core'; * import {SebmGoogleMap} from 'angular2-google-maps/core'; * * @Component({ @@ -39,7 +39,7 @@ import {MarkerManager} from '../services/marker-manager'; inputs: [ 'longitude', 'latitude', 'zoom', 'disableDoubleClickZoom', 'disableDefaultUI', 'scrollwheel', 'backgroundColor', 'draggableCursor', 'draggingCursor', 'keyboardShortcuts', 'zoomControl', - 'styles', 'usePanning' + 'styles', 'usePanning', 'streetViewControl' ], outputs: ['mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle'], host: {'[class.sebm-google-map-container]': 'true'}, @@ -138,12 +138,19 @@ export class SebmGoogleMap implements OnChanges, */ usePanning: boolean = false; + /** + * The initial enabled/disabled state of the Street View Pegman control. + * This control is part of the default UI, and should be set to false when displaying a map type + * on which the Street View road overlay should not appear (e.g. a non-Earth map type). + */ + streetViewControl: boolean = true; + /** * Map option attributes that can change over time */ private static _mapOptionsAttributes: string[] = [ 'disableDoubleClickZoom', 'scrollwheel', 'draggableCursor', 'draggingCursor', - 'keyboardShortcuts', 'zoomControl', 'styles' + 'keyboardShortcuts', 'zoomControl', 'styles', 'streetViewControl' ]; private _observableSubscriptions: Subscription[] = []; @@ -180,6 +187,7 @@ export class SebmGoogleMap implements OnChanges, /** @internal */ ngOnInit() { + // todo: this should be solved with a new component and a viewChild decorator const container = this._elem.nativeElement.querySelector('.sebm-google-map-container-inner'); this._initMapInstance(container); } @@ -194,7 +202,8 @@ export class SebmGoogleMap implements OnChanges, draggingCursor: this.draggingCursor, keyboardShortcuts: this.keyboardShortcuts, zoomControl: this.zoomControl, - styles: this.styles + styles: this.styles, + streetViewControl: this.streetViewControl }); this._handleMapCenterChange(); this._handleMapZoomChange(); diff --git a/src/core/services/google-maps-types.ts b/src/core/services/google-maps-types.ts index 04d5b3c48..3f7201af5 100644 --- a/src/core/services/google-maps-types.ts +++ b/src/core/services/google-maps-types.ts @@ -64,6 +64,7 @@ export interface MapOptions { keyboardShortcuts?: boolean; zoomControl?: boolean; styles?: MapTypeStyle[]; + streetViewControl?: boolean; } export interface MapTypeStyle {