diff --git a/src/core/directives/google-map.ts b/src/core/directives/google-map.ts index b48b9927d..a05220ffd 100644 --- a/src/core/directives/google-map.ts +++ b/src/core/directives/google-map.ts @@ -40,7 +40,7 @@ import {MarkerManager} from '../services/marker-manager'; 'backgroundColor', 'draggableCursor', 'draggingCursor', 'keyboardShortcuts', 'zoomControl', 'styles', 'usePanning' ], - outputs: ['mapClick', 'mapRightClick', 'mapDblClick', 'centerChange'], + outputs: ['mapClick', 'mapRightClick', 'mapDblClick', 'centerChange', 'idle'], host: {'[class.sebm-google-map-container]': 'true'}, styles: [` .sebm-google-map-container-inner { @@ -168,6 +168,11 @@ export class SebmGoogleMap implements OnChanges, */ centerChange: EventEmitter = new EventEmitter(); + /** + * This event is fired when the map becomes idle after panning or zooming. + */ + idle: EventEmitter = new EventEmitter(); + constructor(private _elem: ElementRef, private _mapsWrapper: GoogleMapsAPIWrapper) {} /** @internal */ @@ -191,6 +196,7 @@ export class SebmGoogleMap implements OnChanges, this._handleMapCenterChange(); this._handleMapZoomChange(); this._handleMapMouseEvents(); + this._handleIdleEvent(); } /* @internal */ @@ -254,6 +260,11 @@ export class SebmGoogleMap implements OnChanges, }); } + private _handleIdleEvent() { + this._mapsWrapper.subscribeToMapEvent('idle').subscribe( + () => { this.idle.emit(void 0); }); + } + private _handleMapMouseEvents() { interface Emitter { emit(value: any): void;