Skip to content

Commit

Permalink
feat(AgmMap): add gestureHandling option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jimulle authored and a15177 committed Mar 28, 2017
1 parent 9960522 commit f863228
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
*/
Expand All @@ -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[] = [];
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/core/services/google-maps-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export interface MapOptions {
fullscreenControlOptions?: FullscreenControlOptions;
mapTypeId?: string|MapTypeId;
clickableIcons?: boolean;
gestureHandling?: 'cooperative'|'greedy'|'none'|'auto';
}

export interface MapTypeStyle {
Expand Down

0 comments on commit f863228

Please sign in to comment.