mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
feat(collections): the map's padlock, and a picked place on the full map keeps the map
The collections map gets the trip map's padlock (#2010): locked, a click on a place leaves the camera where it is, so places can be clicked through without the map zooming in and out. One setting for both maps. On the full map a picked place no longer brings the list back: its details dock on the map's edge, or open as a sheet on a narrow screen.
This commit is contained in:
@@ -15,6 +15,9 @@ interface CollectionMapProps {
|
||||
dark: boolean
|
||||
/** A control bar floats over the top of the map (the desktop panel's), so the frame starts below it. */
|
||||
underBar?: boolean
|
||||
/** Given, the padlock sits on the map: locked, picking a place leaves the camera where it is (#2010). */
|
||||
locked?: boolean
|
||||
onToggleLock?: () => void
|
||||
}
|
||||
|
||||
/** How far a pin reaches from its point: half a selected pin (44 px) and the rating badge on its corner. */
|
||||
@@ -69,7 +72,7 @@ function framePoints(places: CollectionPlace[]): [number, number][] {
|
||||
* box instead, clear of the edges and of the controls floating over it, and lands
|
||||
* while the map is built rather than flying in.
|
||||
*/
|
||||
export default function CollectionMap({ places, selectedPlaceId, onOpenPlace, onDeselect, dark, underBar = false }: CollectionMapProps): React.ReactElement {
|
||||
export default function CollectionMap({ places, selectedPlaceId, onOpenPlace, onDeselect, dark, underBar = false, locked = false, onToggleLock }: CollectionMapProps): React.ReactElement {
|
||||
const pts = useMemo(() => mappablePlaces(places).map(withMarkerCategory), [places])
|
||||
const tileUrl = useTileUrl(dark ? OFM_DARK : OFM_POSITRON)
|
||||
const focusPoints = useMemo(() => framePoints(pts), [pts])
|
||||
@@ -95,6 +98,8 @@ export default function CollectionMap({ places, selectedPlaceId, onOpenPlace, on
|
||||
focusPoints={focusPoints}
|
||||
focusKey={focusKey}
|
||||
fitPadding={framePadding(underBar)}
|
||||
followSelection={!locked}
|
||||
onToggleFollow={onToggleLock}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -28,6 +28,9 @@ interface CollectionMapPanelProps {
|
||||
onLabelFilter?: (ids: number[]) => void
|
||||
canManageLabels?: boolean
|
||||
onManageLabels?: () => void
|
||||
/** The padlock on the desktop map (#2010); the phone has no hover to look around with. */
|
||||
mapLocked?: boolean
|
||||
onToggleMapLocked?: () => void
|
||||
t: TranslationFn
|
||||
}
|
||||
|
||||
@@ -39,7 +42,7 @@ interface CollectionMapPanelProps {
|
||||
export default function CollectionMapPanel({
|
||||
places, selectedPlaceId, onSelect, onDeselect, dark, overlay, view, onToggleView,
|
||||
search, onSearch, labelOptions = [], labelFilter = [], onLabelFilter, canManageLabels = false,
|
||||
onManageLabels, t,
|
||||
onManageLabels, mapLocked = false, onToggleMapLocked, t,
|
||||
}: CollectionMapPanelProps): React.ReactElement {
|
||||
const showLabels = onLabelFilter != null && (labelOptions.length > 0 || canManageLabels)
|
||||
return (
|
||||
@@ -51,6 +54,8 @@ export default function CollectionMapPanel({
|
||||
onDeselect={onDeselect}
|
||||
dark={dark}
|
||||
underBar={overlay}
|
||||
locked={overlay && mapLocked}
|
||||
onToggleLock={overlay ? onToggleMapLocked : undefined}
|
||||
/>
|
||||
{overlay && (
|
||||
<div className="col-map-topbar">
|
||||
|
||||
Reference in New Issue
Block a user