From 6d4c44b26209ccc20213ab2e5baff05b8141363b Mon Sep 17 00:00:00 2001 From: Ota Prokopec Date: Thu, 6 Apr 2023 16:51:24 +0200 Subject: [PATCH] location attempt to fix --- src/lib/components/Map/Erantmap.svelte | 8 +++++++- src/routes/map/map.svelte | 14 ++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/lib/components/Map/Erantmap.svelte b/src/lib/components/Map/Erantmap.svelte index 76f70ea..f3b4749 100644 --- a/src/lib/components/Map/Erantmap.svelte +++ b/src/lib/components/Map/Erantmap.svelte @@ -54,7 +54,13 @@ setTimeout(() => userCenter(), 100)} {center} bind:mapComponent class={className} on:move> {}} on:geolocate={(e) => { // @ts-ignore diff --git a/src/routes/map/map.svelte b/src/routes/map/map.svelte index cac1526..91a4db5 100644 --- a/src/routes/map/map.svelte +++ b/src/routes/map/map.svelte @@ -7,13 +7,13 @@ import { getExperiencesAsStore } from '$lib/utils/database/experience' import { onMount } from 'svelte' - let user: { lat: number; lng: number } = { lat: 0, lng: 0 } + let userLocation: { lat: number; lng: number } = { lat: 0, lng: 0 } let granted = false const lastGame = localStorage.getItem('lastGame') const handleLocationGranted = (position: GeolocationPosition) => { - user = { lat: position.coords.latitude, lng: position.coords.longitude } + userLocation = { lat: position.coords.latitude, lng: position.coords.longitude } granted = true } @@ -25,9 +25,15 @@ {#if granted} - + {#each $experiences as experience} - navigate(`/${experience.ExpURL}`)} lat={experience.ExpLocation[0]} lng={experience.ExpLocation[1]} {user} /> + navigate(`/${experience.ExpURL}`)} + lat={experience.ExpLocation[0]} + lng={experience.ExpLocation[1]} + {userLocation} + /> {/each} {:else}