From 6954c473ee13b25735bd8952f5637860bda6ce25 Mon Sep 17 00:00:00 2001 From: evlist Date: Tue, 11 Oct 2022 16:16:06 +0200 Subject: [PATCH] Also moving the map center to the newest location when recording tracks (must think more carefully of somethin better for #12). --- src/components/map/GpxRecord.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/map/GpxRecord.tsx b/src/components/map/GpxRecord.tsx index e821355..f6ff685 100644 --- a/src/components/map/GpxRecord.tsx +++ b/src/components/map/GpxRecord.tsx @@ -31,13 +31,11 @@ import { SettingsState } from '../../store/settings'; import i18n, { setI18nLanguage } from '../../i18n/index'; - declare global { var $lastValidLocationTime: number; } const GpxRecord: React.FC<{}> = () => { - const language = useSelector( (state: { settings: SettingsState }) => state.settings.language ); @@ -106,6 +104,12 @@ const GpxRecord: React.FC<{}> = () => { lon: location.longitude, }) ); + dispatch( + mapActions.setCenter({ + lat: location.latitude, + lon: location.longitude, + }) + ); } }; @@ -182,7 +186,8 @@ const GpxRecord: React.FC<{}> = () => { size='large' onClick={pauseRecording} > - {i18n.pauseRecording} + + {i18n.pauseRecording} )} {hasCurrentTrack && ( @@ -193,7 +198,8 @@ const GpxRecord: React.FC<{}> = () => { size='large' onClick={stopRecording} > - {i18n.stopRecording} + + {i18n.stopRecording} = () => { size='large' onClick={deleteRecording} > - {i18n.cancelRecording} + + {i18n.cancelRecording} )}