diff --git a/src/directives/google-map.ts b/src/directives/google-map.ts index 716d0b46c..fde63d313 100644 --- a/src/directives/google-map.ts +++ b/src/directives/google-map.ts @@ -32,7 +32,9 @@ import {MouseEvent} from '../events'; @Component({ selector: 'sebm-google-map', providers: [GoogleMapsAPIWrapper, MarkerManager], - inputs: ['longitude', 'latitude', 'zoom', 'disableDoubleClickZoom', 'disableDefaultUI'], + inputs: [ + 'longitude', 'latitude', 'zoom', 'disableDoubleClickZoom', 'disableDefaultUI', 'scrollwheel' + ], outputs: ['mapClick', 'mapRightClick', 'mapDblClick'], host: {'[class.sebm-google-map-container]': 'true'}, styles: [` @@ -51,6 +53,7 @@ export class SebmGoogleMap implements OnChanges, private _longitude: number = 0; private _latitude: number = 0; private _zoom: number = 8; + private _scrollwheel: boolean = true; /** * Enables/disables zoom and center on double click. Enabled by default. */ @@ -97,7 +100,8 @@ export class SebmGoogleMap implements OnChanges, this._mapsWrapper.createMap(el, { center: {lat: this._latitude, lng: this._longitude}, zoom: this._zoom, - disableDefaultUI: this.disableDefaultUI + disableDefaultUI: this.disableDefaultUI, + scrollwheel: this._scrollwheel }); this._handleMapCenterChange(); this._handleMapZoomChange(); @@ -140,6 +144,11 @@ export class SebmGoogleMap implements OnChanges, } } + /** + * Sets the scrollwheel enables/disables on map. The default value is true + */ + set scrollwheel(value: boolean) { this._mapsWrapper.scrollwheel(value); } + /** * The longitude that sets the center of the map. */ diff --git a/src/services/google-maps-api-wrapper.ts b/src/services/google-maps-api-wrapper.ts index cdaee1d5a..b9b5459e0 100644 --- a/src/services/google-maps-api-wrapper.ts +++ b/src/services/google-maps-api-wrapper.ts @@ -63,6 +63,10 @@ export class GoogleMapsAPIWrapper { return this._map.then((map: mapTypes.GoogleMap) => map.setZoom(zoom)); } + scrollwheel(scrollwheel: boolean): Promise { + return this._map.then((map: mapTypes.GoogleMap) => { map.scrollwheel = scrollwheel; }); + } + getCenter(): Promise { return this._map.then((map: mapTypes.GoogleMap) => map.getCenter()); } diff --git a/src/services/google-maps-types.ts b/src/services/google-maps-types.ts index f7e33e640..f339b71a1 100644 --- a/src/services/google-maps-types.ts +++ b/src/services/google-maps-types.ts @@ -1,6 +1,7 @@ export var google: any; export interface GoogleMap { + scrollwheel?: boolean; constructor(el: HTMLElement, opts?: MapOptions): void; panTo(latLng: LatLng | LatLngLiteral): void; setZoom(zoom: number): void; @@ -56,4 +57,5 @@ export interface MapOptions { zoom?: number; disableDoubleClickZoom?: boolean; disableDefaultUI?: boolean; + scrollwheel?: boolean; }