Fix map entities (#2883)

* Fix map entities

* Fix switching tabs
This commit is contained in:
Paulus Schoutsen
2019-03-05 11:28:31 -08:00
committed by GitHub
parent b25fff9852
commit f008f8f41a
2 changed files with 15 additions and 6 deletions

View File

@@ -4,8 +4,11 @@ import { Map } from "leaflet";
export type LeafletModuleType = typeof import("leaflet");
export const setupLeafletMap = async (
mapElement
mapElement: HTMLElement
): Promise<[Map, LeafletModuleType]> => {
if (!mapElement.parentNode) {
throw new Error("Cannot setup Leaflet map on disconnected element");
}
// tslint:disable-next-line
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet")) as LeafletModuleType;
Leaflet.Icon.Default.imagePath = "/static/images/leaflet";