Showing the current location.
This commit is contained in:
1 parent
1efdc30e5c
commit
2c79c74376
4 files changed
+70
-12
No files matched your search
@@ -1,5 +1,4 @@
|
||||
//import React from 'react';
|
||||
import { Component } from 'solid-js';
|
||||
import { Component, createEffect, createSignal } from 'solid-js';
|
||||
import { useNavigate } from '@solidjs/router';
|
||||
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
|
||||
|
||||
@@ -8,6 +7,11 @@ import LocationSearchingIcon from '@suid/icons-material/LocationSearching';
|
||||
import { IconButton } from '@suid/material';
|
||||
import { getState } from '../map';
|
||||
|
||||
export const [getCurrentLocation, setCurrentLocation] = createSignal<{
|
||||
lon: number;
|
||||
lat: number;
|
||||
} | null>(null);
|
||||
|
||||
const GetLocation: Component = () => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
@@ -19,6 +23,10 @@ const GetLocation: Component = () => {
|
||||
navigate(
|
||||
`/map/${position.coords.longitude}/${position.coords.latitude}/${state.zoom}/${state.rotation}`
|
||||
);
|
||||
setCurrentLocation({
|
||||
lon: position.coords.longitude,
|
||||
lat: position.coords.latitude,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<svg height="24" width="24" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
||||
<circle
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="6"
|
||||
fill='blue'
|
||||
opacity='90%'
|
||||
stroke='white'
|
||||
stroke-width="4"
|
||||
stroke-opacity='100%'
|
||||
/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 240 B |
@@ -1 +1 @@
|
||||
export { default } from './GetLocation';
|
||||
export { default, getCurrentLocation, setCurrentLocation } from './GetLocation';
|
||||
Reference in new issue
Block a user