From 1a145709d2c0fdae0ad071fc691a60c3495b903b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20M=C3=BCller?= Date: Mon, 21 Mar 2016 21:15:55 +0100 Subject: [PATCH] feat(SebmGoogleMap): support keyboardShortcuts opt Closes #236 --- src/directives/google-map.ts | 17 +++++++++++++---- src/services/google-maps-types.ts | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/directives/google-map.ts b/src/directives/google-map.ts index f49afd0ea..04f3296ac 100644 --- a/src/directives/google-map.ts +++ b/src/directives/google-map.ts @@ -34,7 +34,7 @@ import {MouseEvent} from '../events'; providers: [GoogleMapsAPIWrapper, MarkerManager], inputs: [ 'longitude', 'latitude', 'zoom', 'disableDoubleClickZoom', 'disableDefaultUI', 'scrollwheel', - 'backgroundColor', 'draggableCursor', 'draggingCursor' + 'backgroundColor', 'draggableCursor', 'draggingCursor', 'keyboardShortcuts' ], outputs: ['mapClick', 'mapRightClick', 'mapDblClick', 'centerChange'], host: {'[class.sebm-google-map-container]': 'true'}, @@ -92,11 +92,19 @@ export class SebmGoogleMap implements OnChanges, */ draggingCursor: string; + /** + * If false, prevents the map from being controlled by the keyboard. Keyboard shortcuts are + * enabled by default. + */ + keyboardShortcuts: boolean = true; + /** * Map option attributes that can change over time */ - private static _mapOptionsAttributes: string[] = - ['disableDoubleClickZoom', 'scrollwheel', 'draggableCursor', 'draggingCursor']; + private static _mapOptionsAttributes: string[] = [ + 'disableDoubleClickZoom', 'scrollwheel', 'draggableCursor', 'draggingCursor', + 'keyboardShortcuts' + ]; /** * This event emitter gets emitted when the user clicks on the map (but not when they click on a @@ -136,7 +144,8 @@ export class SebmGoogleMap implements OnChanges, disableDefaultUI: this.disableDefaultUI, backgroundColor: this.backgroundColor, draggableCursor: this.draggableCursor, - draggingCursor: this.draggingCursor + draggingCursor: this.draggingCursor, + keyboardShortcuts: this.keyboardShortcuts }); this._handleMapCenterChange(); this._handleMapZoomChange(); diff --git a/src/services/google-maps-types.ts b/src/services/google-maps-types.ts index d186fbc8f..99001c3e6 100644 --- a/src/services/google-maps-types.ts +++ b/src/services/google-maps-types.ts @@ -61,4 +61,5 @@ export interface MapOptions { backgroundColor?: string; draggableCursor?: string; draggingCursor?: string; + keyboardShortcuts?: boolean; }