Also moving the map center to the newest location when recording tracks (must think more carefully of somethin better for #12).

This commit is contained in:
Eric van der Vlist 2022-10-11 16:16:06 +02:00
parent 57d17a1fa6
commit 6954c473ee
1 changed files with 12 additions and 5 deletions

View File

@ -31,13 +31,11 @@ import { SettingsState } from '../../store/settings';
import i18n, { setI18nLanguage } from '../../i18n/index'; import i18n, { setI18nLanguage } from '../../i18n/index';
declare global { declare global {
var $lastValidLocationTime: number; var $lastValidLocationTime: number;
} }
const GpxRecord: React.FC<{}> = () => { const GpxRecord: React.FC<{}> = () => {
const language = useSelector( const language = useSelector(
(state: { settings: SettingsState }) => state.settings.language (state: { settings: SettingsState }) => state.settings.language
); );
@ -106,6 +104,12 @@ const GpxRecord: React.FC<{}> = () => {
lon: location.longitude, lon: location.longitude,
}) })
); );
dispatch(
mapActions.setCenter({
lat: location.latitude,
lon: location.longitude,
})
);
} }
}; };
@ -182,7 +186,8 @@ const GpxRecord: React.FC<{}> = () => {
size='large' size='large'
onClick={pauseRecording} onClick={pauseRecording}
> >
<IonIcon slot='start' icon={pauseCircle}></IonIcon>{i18n.pauseRecording} <IonIcon slot='start' icon={pauseCircle}></IonIcon>
{i18n.pauseRecording}
</IonButton> </IonButton>
)} )}
{hasCurrentTrack && ( {hasCurrentTrack && (
@ -193,7 +198,8 @@ const GpxRecord: React.FC<{}> = () => {
size='large' size='large'
onClick={stopRecording} onClick={stopRecording}
> >
<IonIcon slot='start' icon={stop}></IonIcon>{i18n.stopRecording} <IonIcon slot='start' icon={stop}></IonIcon>
{i18n.stopRecording}
</IonButton> </IonButton>
<IonButton <IonButton
expand='block' expand='block'
@ -201,7 +207,8 @@ const GpxRecord: React.FC<{}> = () => {
size='large' size='large'
onClick={deleteRecording} onClick={deleteRecording}
> >
<IonIcon slot='start' icon={closeCircle}></IonIcon>{i18n.cancelRecording} <IonIcon slot='start' icon={closeCircle}></IonIcon>
{i18n.cancelRecording}
</IonButton> </IonButton>
</> </>
)} )}