From 4b2c360e1715bddfedd1ef7992d5c48222845e19 Mon Sep 17 00:00:00 2001 From: Nulo Date: Sat, 14 Sep 2024 18:04:43 -0300 Subject: [PATCH] arreglar mapa --- sepa/sitio2/src/lib/components/Map.svelte | 13 ++++++------- sepa/sitio2/src/routes/id_producto/[id]/+page.ts | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 sepa/sitio2/src/routes/id_producto/[id]/+page.ts diff --git a/sepa/sitio2/src/lib/components/Map.svelte b/sepa/sitio2/src/lib/components/Map.svelte index 0c45df9..75459e0 100644 --- a/sepa/sitio2/src/lib/components/Map.svelte +++ b/sepa/sitio2/src/lib/components/Map.svelte @@ -2,25 +2,24 @@ import { onDestroy, onMount, tick } from 'svelte'; import 'leaflet/dist/leaflet.css'; import style from './map_style.json'; - import type L from 'leaflet'; + import L from 'leaflet'; + import 'maplibre-gl'; + import '@maplibre/maplibre-gl-leaflet'; let mapEl: HTMLDivElement; export let mapMap: (map: L.Map, l: typeof L) => void; let map: L.Map | undefined; onMount(async () => { - window.L = await import('leaflet'); - const L2 = await import('maplibre-gl'); - const L3 = await import('@maplibre/maplibre-gl-leaflet'); // Set up initial map center and zoom level - map = window.L.map(mapEl, { + map = L.map(mapEl, { center: [-34.599722222222, -58.381944444444], // EDIT latitude, longitude to re-center map zoom: 9, // EDIT from 1 to 18 -- decrease to zoom out, increase to zoom in scrollWheelZoom: true // Changed to true to enable zoom with scrollwheel // tap: false }); - window.L.maplibreGL({ + L.maplibreGL({ style: style as any, attribution: '© Stadia Maps, © OpenMapTiles © OpenStreetMap' @@ -28,7 +27,7 @@ // display Carto basemap tiles with light features and labels // L.tileLayer.provider('Stadia.AlidadeSmoothBackground').addTo(map); - mapMap(map, window.L); + mapMap(map, L); }); onDestroy(() => { diff --git a/sepa/sitio2/src/routes/id_producto/[id]/+page.ts b/sepa/sitio2/src/routes/id_producto/[id]/+page.ts new file mode 100644 index 0000000..a3d1578 --- /dev/null +++ b/sepa/sitio2/src/routes/id_producto/[id]/+page.ts @@ -0,0 +1 @@ +export const ssr = false;