Skip to content

Commit

Permalink
Wait for the tiles to be loaded to display the map
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jan 7, 2025
1 parent 16ec95f commit 6c7d383
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/fxc-front/src/app/components/2d/map-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,19 @@ export class MapElement extends connect(store)(LitElement) {
document.addEventListener('visibilitychange', () => this.zoomToTracks(), { once: true });
}

store.dispatch(setApiLoading(false));
google.maps.event.addListenerOnce(this.map, 'tilesloaded', () => {
store.dispatch(setApiLoading(false));
});
});
}

disconnectedCallback(): void {
super.disconnectedCallback();
this.subscriptions.forEach((sub) => sub());
this.subscriptions.length = 0;
if (this.map) {
google.maps.event.clearInstanceListeners(this.map);
}
this.map = undefined;
}

Expand Down

0 comments on commit 6c7d383

Please sign in to comment.