Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(AgmMap): Add tilesloaded event to AgmMap #1706

Merged
2 commits merged into from
Aug 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/core/directives/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
*/
@Output() mapReady: EventEmitter<any> = new EventEmitter<any>();

/**
* This event is fired when the visible tiles have finished loading.
*/
@Output() tilesLoaded: EventEmitter<void> = new EventEmitter<void>();

constructor(private _elem: ElementRef, private _mapsWrapper: GoogleMapsAPIWrapper, protected _fitBoundsService: FitBoundsService, private _zone: NgZone) {
}

Expand Down Expand Up @@ -413,6 +418,7 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
this._handleMapMouseEvents();
this._handleBoundsChange();
this._handleMapTypeIdChange();
this._handleTilesLoadedEvent();
this._handleIdleEvent();
}

Expand Down Expand Up @@ -577,6 +583,13 @@ export class AgmMap implements OnChanges, OnInit, OnDestroy {
this._observableSubscriptions.push(s);
}

private _handleTilesLoadedEvent() {
const s = this._mapsWrapper.subscribeToMapEvent<void>('tilesloaded').subscribe(
() => this.tilesLoaded.emit(void 0)
);
this._observableSubscriptions.push(s);
}

private _handleMapMouseEvents() {
interface Emitter {
emit(value: any): void;
Expand Down