From 72c56c8245cc54fe064504937a13c81bd5d502d3 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Fri, 15 Aug 2025 00:21:30 +0000 Subject: [PATCH] Add button to recentre view --- mapper/src/App.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mapper/src/App.js b/mapper/src/App.js index f2f4190..1fb5063 100644 --- a/mapper/src/App.js +++ b/mapper/src/App.js @@ -274,7 +274,7 @@ function Map({end, duration, slider, mapState, setMapState, setSubmenu, showDire ); } -function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, setSubmenu, showDirection, setShowDirection}) { +function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, setSubmenu, showDirection, setShowDirection, setMapState}) { const [showRange, setShowRange] = useState(false); const chooseDuration = (x) => { @@ -330,6 +330,11 @@ function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, s window.location.href = window.location.pathname; }; + const recentreView = () => { + setMapState(prev => ({ ...prev, center: null })); + setSubmenu(false); + }; + const range = parseSlider(end, duration, slider); const shareRange = async () => { @@ -480,6 +485,7 @@ function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, s /> Show direction + @@ -586,6 +592,7 @@ function App() { setSubmenu={setSubmenu} showDirection={showDirection} setShowDirection={setShowDirection} + setMapState={setMapState} />