mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
feat(journey): satellite base layer on every journey map, the shared page included (#2594)
The journey map gets the planner's round satellite switch in its top corner, on the desktop aside, the phone views and the public page. Leaflet takes the vector basemap off while the imagery shows and reattaches it on the way back; the GL renderer slides the imagery under the journey's own layers. The choice is per view and opens on the map, so no setting is read or written.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Anchor, Bike, Footprints, Loader2, Map as MapIcon, MapPinPlus, Mountain, MountainSnow, Rotate3d, Satellite } from 'lucide-react'
|
||||
import type { PaddleMapLayer } from '../Tours/paddle/paddleMapLayer'
|
||||
import { PisteKeyButton } from '../Tours/winter/PisteKey'
|
||||
import type { ComponentType, CSSProperties } from 'react'
|
||||
import type { ComponentProps, ComponentType, CSSProperties } from 'react'
|
||||
import { useTranslation } from '../../i18n'
|
||||
import { FerrataLineIcon } from '../Ferratas/FerrataGlyph'
|
||||
import type { FerrataMapLayer } from '../Ferratas/useFerrataMapLayer'
|
||||
@@ -42,8 +42,17 @@ export const MAP_ROUND_CONTROL_SIZE = 42
|
||||
|
||||
// Round base-layer switcher for both planner maps, Leaflet and GL (default street
|
||||
// tiles ↔ satellite). Same frosted shell as MapCompassPill so it lines up with the
|
||||
// other map controls; the icon shows the layer it switches to.
|
||||
export function MapLayerSwitcher({ active, onToggle }: { active: BaseLayer; onToggle: () => void }) {
|
||||
// other map controls; the icon shows the layer it switches to. The journey map
|
||||
// wears it too, in its top corner, so its tooltip can open below instead.
|
||||
export function MapLayerSwitcher({
|
||||
active,
|
||||
onToggle,
|
||||
tooltipPlacement = 'right',
|
||||
}: {
|
||||
active: BaseLayer
|
||||
onToggle: () => void
|
||||
tooltipPlacement?: ComponentProps<typeof Tooltip>['placement']
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const isSatellite = active === 'satellite'
|
||||
const Icon = isSatellite ? MapIcon : Satellite
|
||||
@@ -55,7 +64,7 @@ export function MapLayerSwitcher({ active, onToggle }: { active: BaseLayer; onTo
|
||||
TripRouteOverviewPill. To the right, though: this one sits at the
|
||||
bottom left of the map, where a tooltip to the left would land on the
|
||||
day sidebar and one below would land off the screen. */}
|
||||
<Tooltip label={label} placement="right">
|
||||
<Tooltip label={label} placement={tooltipPlacement}>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onToggle}
|
||||
|
||||
@@ -24,8 +24,9 @@ const SATELLITE_LAYER_ID = 'trip-satellite-raster';
|
||||
// Everything TREK draws on a GL map, so the satellite raster can be slipped underneath all
|
||||
// of it. `route-alt-` earns its place here: the roads offered for a leg are added before the
|
||||
// route source so they sit under the current route, which also puts them before the first
|
||||
// `trip-` layer, and anchoring the imagery there painted right over them.
|
||||
export const OWN_LAYER_PREFIXES = ['trip-', 'trek-', 'route-alt-'];
|
||||
// `trip-` layer, and anchoring the imagery there painted right over them. `journey-` is
|
||||
// the journey map's own: its tracks and the line between its entries (#2594).
|
||||
export const OWN_LAYER_PREFIXES = ['trip-', 'trek-', 'route-alt-', 'journey-'];
|
||||
|
||||
/**
|
||||
* A GL map's zoom on the 256 px tile scale that raster tile URLs, their
|
||||
|
||||
Reference in New Issue
Block a user