Add button to recentre view
This commit is contained in:
@@ -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 [showRange, setShowRange] = useState(false);
|
||||||
|
|
||||||
const chooseDuration = (x) => {
|
const chooseDuration = (x) => {
|
||||||
@@ -330,6 +330,11 @@ function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, s
|
|||||||
window.location.href = window.location.pathname;
|
window.location.href = window.location.pathname;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const recentreView = () => {
|
||||||
|
setMapState(prev => ({ ...prev, center: null }));
|
||||||
|
setSubmenu(false);
|
||||||
|
};
|
||||||
|
|
||||||
const range = parseSlider(end, duration, slider);
|
const range = parseSlider(end, duration, slider);
|
||||||
|
|
||||||
const shareRange = async () => {
|
const shareRange = async () => {
|
||||||
@@ -480,6 +485,7 @@ function Menu({duration, setDuration, end, setEnd, slider, setSlider, submenu, s
|
|||||||
/>
|
/>
|
||||||
Show direction
|
Show direction
|
||||||
</label>
|
</label>
|
||||||
|
<button onClick={recentreView}>Recentre view</button>
|
||||||
<button onClick={shareRange}>Share range</button>
|
<button onClick={shareRange}>Share range</button>
|
||||||
<button onClick={resetToDefaults}>Reset to defaults</button>
|
<button onClick={resetToDefaults}>Reset to defaults</button>
|
||||||
</>
|
</>
|
||||||
@@ -586,6 +592,7 @@ function App() {
|
|||||||
setSubmenu={setSubmenu}
|
setSubmenu={setSubmenu}
|
||||||
showDirection={showDirection}
|
showDirection={showDirection}
|
||||||
setShowDirection={setShowDirection}
|
setShowDirection={setShowDirection}
|
||||||
|
setMapState={setMapState}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Map
|
<Map
|
||||||
|
|||||||
Reference in New Issue
Block a user