Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit f863228

Browse files
jimullea15177
authored andcommitted
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
1 parent 9960522 commit f863228

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/core/directives/map.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {DataLayerManager} from './../services/managers/data-layer-manager';
4949
'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'zoomControlOptions', 'styles', 'usePanning',
5050
'streetViewControl', 'streetViewControlOptions', 'fitBounds', 'mapTypeControl', 'mapTypeControlOptions',
5151
'panControlOptions', 'rotateControl', 'rotateControlOptions', 'fullscreenControl', 'fullscreenControlOptions',
52-
'scaleControl', 'scaleControlOptions', 'mapTypeId', 'clickableIcons'
52+
'scaleControl', 'scaleControlOptions', 'mapTypeId', 'clickableIcons', 'gestureHandling'
5353
],
5454
outputs: [
5555
'mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle', 'boundsChange', 'zoomChange'
@@ -252,6 +252,16 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
252252
*/
253253
clickableIcons: boolean = true;
254254

255+
/**
256+
* This setting controls how gestures on the map are handled.
257+
* Allowed values:
258+
* - 'cooperative' (Two-finger touch gestures pan and zoom the map. One-finger touch gestures are not handled by the map.)
259+
* - 'greedy' (All touch gestures pan or zoom the map.)
260+
* - 'none' (The map cannot be panned or zoomed by user gestures.)
261+
* - 'auto' [default] (Gesture handling is either cooperative or greedy, depending on whether the page is scrollable or not.
262+
*/
263+
gestureHandling: 'cooperative'|'greedy'|'none'|'auto' = 'auto';
264+
255265
/**
256266
* Map option attributes that can change over time
257267
*/
@@ -261,7 +271,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
261271
'streetViewControlOptions', 'zoom', 'mapTypeControl', 'mapTypeControlOptions', 'minZoom',
262272
'maxZoom', 'panControl', 'panControlOptions', 'rotateControl', 'rotateControlOptions',
263273
'fullscreenControl', 'fullscreenControlOptions', 'scaleControl', 'scaleControlOptions',
264-
'mapTypeId', 'clickableIcons'
274+
'mapTypeId', 'clickableIcons', 'gestureHandling'
265275
];
266276

267277
private _observableSubscriptions: Subscription[] = [];
@@ -343,7 +353,8 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
343353
fullscreenControl: this.fullscreenControl,
344354
fullscreenControlOptions: this.fullscreenControlOptions,
345355
mapTypeId: this.mapTypeId,
346-
clickableIcons: this.clickableIcons
356+
clickableIcons: this.clickableIcons,
357+
gestureHandling: this.gestureHandling
347358
});
348359

349360
// register event listeners

src/core/services/google-maps-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export interface MapOptions {
148148
fullscreenControlOptions?: FullscreenControlOptions;
149149
mapTypeId?: string|MapTypeId;
150150
clickableIcons?: boolean;
151+
gestureHandling?: 'cooperative'|'greedy'|'none'|'auto';
151152
}
152153

153154
export interface MapTypeStyle {

0 commit comments

Comments
 (0)