mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 11:36:05 +00:00
9494521ac7
- Paddle as a plannable tour type: one boat (kayak, canoe, SUP, other), river or lake, a pace that a boat change never overwrites; time is distance over pace - Hand-drawn legs beside routed ones, drawn dotted and labelled as not routed, kept through save, reopen and edits elsewhere - Reverse a tour and close it back to its start, each one undo step - GPX import shows a preview first (line, measures, duplicates, type) and only the confirmation stores the tour - Base maps and overlays per tour type in the planner: hike keeps topo and the via ferrata layer, paddle gets the OpenSeaMap seamark overlay
22 lines
878 B
TypeScript
22 lines
878 B
TypeScript
import { useCallback, useState } from 'react';
|
|
import type { TourBaseLayer } from '../../Map/MapLayerSwitcher';
|
|
|
|
/**
|
|
* How the planner's map looks, kept with the planner so it lasts while tours
|
|
* are opened, saved and closed: the base layer and the overlays switched on.
|
|
* Planner-local by design (P2B-07): nothing here touches the global map
|
|
* setting, and none of it changes a tour.
|
|
*/
|
|
export function useTourMapView() {
|
|
const [mapBaseLayer, setMapBaseLayer] = useState<TourBaseLayer>('default');
|
|
const [mapOverlays, setMapOverlays] = useState<ReadonlySet<string>>(() => new Set());
|
|
const toggleMapOverlay = useCallback((id: string) => {
|
|
setMapOverlays((current) => {
|
|
const next = new Set(current);
|
|
if (!next.delete(id)) next.add(id);
|
|
return next;
|
|
});
|
|
}, []);
|
|
return { mapBaseLayer, setMapBaseLayer, mapOverlays, toggleMapOverlay };
|
|
}
|