Re-implementing GetLocation

This commit is contained in:
vdv committed 2022-11-25 21:09:59 +01:00
1 parent ef8ee5e00e
commit 1efdc30e5c
8 files changed
+293 -19

No files matched your search

@@ -0,0 +1,7 @@
.getLocation {
--opacity: 0.6;
--ion-background-color: white;
margin-left: calc(50% - 20px) !important;
position: fixed !important;
bottom: 6px;
}
@@ -0,0 +1,33 @@
//import React from 'react';
import { Component } from 'solid-js';
import { useNavigate } from '@solidjs/router';
import { Geolocation } from '@awesome-cordova-plugins/geolocation';
import style from './GetLocation.module.css';
import LocationSearchingIcon from '@suid/icons-material/LocationSearching';
import { IconButton } from '@suid/material';
import { getState } from '../map';
const GetLocation: Component = () => {
const navigate = useNavigate();
const onClickHandler = (event: any) => {
console.log('Click handler');
Geolocation.getCurrentPosition().then((position) => {
console.log({ caller: 'GetLocation/onClickHandler', position });
const state = getState();
navigate(
`/map/${position.coords.longitude}/${position.coords.latitude}/${state.zoom}/${state.rotation}`
);
});
};
//
return (
<IconButton class={style.getLocation} onClick={onClickHandler}>
<LocationSearchingIcon />
</IconButton>
);
};
export default GetLocation;
+1
View File
@@ -0,0 +1 @@
export { default } from './GetLocation';