From 3abf99a71ca63f0a9beba8b66a88edde420962df Mon Sep 17 00:00:00 2001 From: Jim Ulle Date: Tue, 28 Mar 2017 16:42:32 +0000 Subject: [PATCH] feat(AgmMap): add gestureHandling option The gestureHandling attribute in MapOptions controls how gestures on the map are handled. The attribute takes one of four string values (cooperative, greedy, none and auto). Changes are not breaking, gestureHandling is an optional attribute and the google maps api defaults this attribute to 'auto'. Closes #919 --- src/core/directives/map.ts | 17 ++++++++++++++--- src/core/services/google-maps-types.ts | 1 + 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/directives/map.ts b/src/core/directives/map.ts index da2508e1d..3894036f7 100644 --- a/src/core/directives/map.ts +++ b/src/core/directives/map.ts @@ -49,7 +49,7 @@ import {DataLayerManager} from './../services/managers/data-layer-manager'; 'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'zoomControlOptions', 'styles', 'usePanning', 'streetViewControl', 'streetViewControlOptions', 'fitBounds', 'mapTypeControl', 'mapTypeControlOptions', 'panControlOptions', 'rotateControl', 'rotateControlOptions', 'fullscreenControl', 'fullscreenControlOptions', - 'scaleControl', 'scaleControlOptions', 'mapTypeId', 'clickableIcons' + 'scaleControl', 'scaleControlOptions', 'mapTypeId', 'clickableIcons', 'gestureHandling' ], outputs: [ 'mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle', 'boundsChange', 'zoomChange' @@ -252,6 +252,16 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { */ clickableIcons: boolean = true; + /** + * This setting controls how gestures on the map are handled. + * Allowed values: + * - 'cooperative' (Two-finger touch gestures pan and zoom the map. One-finger touch gestures are not handled by the map.) + * - 'greedy' (All touch gestures pan or zoom the map.) + * - 'none' (The map cannot be panned or zoomed by user gestures.) + * - 'auto' [default] (Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or not. + */ + gestureHandling: 'cooperative'|'greedy'|'none'|'auto' = 'auto'; + /** * Map option attributes that can change over time */ @@ -261,7 +271,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { 'streetViewControlOptions', 'zoom', 'mapTypeControl', 'mapTypeControlOptions', 'minZoom', 'maxZoom', 'panControl', 'panControlOptions', 'rotateControl', 'rotateControlOptions', 'fullscreenControl', 'fullscreenControlOptions', 'scaleControl', 'scaleControlOptions', - 'mapTypeId', 'clickableIcons' + 'mapTypeId', 'clickableIcons', 'gestureHandling' ]; private _observableSubscriptions: Subscription[] = []; @@ -343,7 +353,8 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy { fullscreenControl: this.fullscreenControl, fullscreenControlOptions: this.fullscreenControlOptions, mapTypeId: this.mapTypeId, - clickableIcons: this.clickableIcons + clickableIcons: this.clickableIcons, + gestureHandling: this.gestureHandling }); // register event listeners diff --git a/src/core/services/google-maps-types.ts b/src/core/services/google-maps-types.ts index 57d01af36..20e3ce045 100644 --- a/src/core/services/google-maps-types.ts +++ b/src/core/services/google-maps-types.ts @@ -148,6 +148,7 @@ export interface MapOptions { fullscreenControlOptions?: FullscreenControlOptions; mapTypeId?: string|MapTypeId; clickableIcons?: boolean; + gestureHandling?: 'cooperative'|'greedy'|'none'|'auto'; } export interface MapTypeStyle {