diff --git a/apps/client/src/widgets/view_widgets/geo_view/index.ts b/apps/client/src/widgets/view_widgets/geo_view/index.ts index 5987e96e7..040e37e18 100644 --- a/apps/client/src/widgets/view_widgets/geo_view/index.ts +++ b/apps/client/src/widgets/view_widgets/geo_view/index.ts @@ -10,8 +10,8 @@ import toast from "../../../services/toast.js"; import { CommandListenerData, EventData } from "../../../components/app_context.js"; import { createNewNote, moveMarker, setupDragging } from "./editing.js"; import { openMapContextMenu } from "./context_menu.js"; -import getMapLayer from "./map_layer.js"; import attributes from "../../../services/attributes.js"; +import { MAP_LAYERS } from "./map_layer.js"; const TPL = /*html*/`
@@ -337,3 +337,21 @@ export default class GeoView extends ViewMode { } } + +async function getMapLayer(layerName: string) { + const layer = MAP_LAYERS[layerName] ?? MAP_LAYERS["openstreetmap"]; + + if (layer.type === "vector") { + const style = (typeof layer.style === "string" ? layer.style : await layer.style()); + await import("@maplibre/maplibre-gl-leaflet"); + + return L.maplibreGL({ + style: style as any + }); + } + + return L.tileLayer(layer.url, { + attribution: layer.attribution, + detectRetina: true + }); +} diff --git a/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts b/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts index a88344cf5..422f1d613 100644 --- a/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts +++ b/apps/client/src/widgets/view_widgets/geo_view/map_layer.ts @@ -1,5 +1,3 @@ -import L from "leaflet"; - interface Layer { name: string; } @@ -54,20 +52,3 @@ export const MAP_LAYERS: Record = { } }; -export default async function getMapLayer(layerName: string) { - const layer = MAP_LAYERS[layerName] ?? MAP_LAYERS["openstreetmap"]; - - if (layer.type === "vector") { - const style = (typeof layer.style === "string" ? layer.style : await layer.style()); - await import("@maplibre/maplibre-gl-leaflet"); - - return L.maplibreGL({ - style: style as any - }); - } - - return L.tileLayer(layer.url, { - attribution: layer.attribution, - detectRetina: true - }); -}