mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
fix(mobile): on a narrow 3D map the flyover controls and grade legend stand as a column of icons on the side, the layer pill keeps the bottom row; and the lint ratchets the last push tipped
This commit is contained in:
@@ -1126,7 +1126,7 @@ export const MapView = memo(function MapView({
|
||||
{/* 20px off the sidebar, not 12: the pill is round and frosted, so at the
|
||||
smaller gap its shadow ran into the sidebar edge and the two read as one
|
||||
surface. */}
|
||||
<div style={{ position: 'absolute', left: leftWidth + MAP_LAYER_SWITCHER_INSET, right: rightWidth + LOCATE_BUTTON_ROOM, bottom: switcherBottom, zIndex: 1000, pointerEvents: 'none', display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 8 }}>
|
||||
<div style={{ position: 'absolute', left: leftWidth + MAP_LAYER_SWITCHER_INSET, width: `calc(100% - ${leftWidth + MAP_LAYER_SWITCHER_INSET + rightWidth + LOCATE_BUTTON_ROOM}px)`, bottom: switcherBottom, zIndex: 1000, pointerEvents: 'none', display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 8 }}>
|
||||
{onToggleFollow && <MapLockPill locked={!followSelection} onToggle={onToggleFollow} />}
|
||||
{hasViewBaseLayer
|
||||
? <TourMapLayerSwitcher active={baseLayer} onChange={onViewBaseLayerChange}
|
||||
|
||||
@@ -2060,7 +2060,7 @@ export function MapViewGL({
|
||||
card too, and used to send the pill to the top of the map for a corner it never
|
||||
covers. */}
|
||||
<div style={{
|
||||
position: 'absolute', left: leftWidth + MAP_LAYER_SWITCHER_INSET, right: rightWidth + LOCATE_BUTTON_ROOM, zIndex: 1000, pointerEvents: 'none',
|
||||
position: 'absolute', left: leftWidth + MAP_LAYER_SWITCHER_INSET, width: `calc(100% - ${leftWidth + MAP_LAYER_SWITCHER_INSET + rightWidth + LOCATE_BUTTON_ROOM}px)`, zIndex: 1000, pointerEvents: 'none',
|
||||
display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 8,
|
||||
bottom: isMobile && hasDayDetail
|
||||
? 'calc(var(--bottom-nav-h, 0px) + 20px + var(--day-panel-h, 0px) + 12px)'
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('VectorBasemap', () => {
|
||||
const { findByTestId, queryByTestId } = render(<VectorBasemap style={OFM_POSITRON} />)
|
||||
await waitFor(() => expect(maplibreGL).toHaveBeenCalledTimes(1))
|
||||
const { layer, gl } = lastLayer()
|
||||
const onError = gl.on.mock.calls.find(([name]) => name === 'error')![1] as (e: { error?: unknown }) => void
|
||||
const onError = gl.on.mock.calls.find(([name]) => name === 'error')?.[1] as (e: { error?: unknown }) => void
|
||||
expect(gl.once).toHaveBeenCalledWith('style.load', expect.any(Function))
|
||||
expect(queryByTestId('raster-basemap')).toBeNull()
|
||||
|
||||
@@ -146,8 +146,8 @@ describe('VectorBasemap', () => {
|
||||
render(<VectorBasemap style={OFM_POSITRON} />)
|
||||
await waitFor(() => expect(maplibreGL).toHaveBeenCalledTimes(2))
|
||||
const second = lastLayer()
|
||||
const secondError = second.gl.on.mock.calls.find(([name]) => name === 'error')![1] as (e: { error?: unknown }) => void
|
||||
;(second.gl.once.mock.calls.find(([name]) => name === 'style.load')![1] as () => void)()
|
||||
const secondError = second.gl.on.mock.calls.find(([name]) => name === 'error')?.[1] as (e: { error?: unknown }) => void
|
||||
;(second.gl.once.mock.calls.find(([name]) => name === 'style.load')?.[1] as () => void)()
|
||||
act(() => secondError({ error: new Error('one tile') }))
|
||||
expect(second.layer.remove).not.toHaveBeenCalled()
|
||||
warn.mockRestore()
|
||||
|
||||
@@ -118,10 +118,9 @@ function onStyleFailure(layer: GlLeafletLayer, fail: () => void): void {
|
||||
gl.once('style.load', () => {
|
||||
loaded = true
|
||||
})
|
||||
const onError = (event: { error?: unknown }) => {
|
||||
const onError = () => {
|
||||
if (loaded) return
|
||||
gl.off('error', onError)
|
||||
console.warn('[basemap] the vector style did not load, drawing raster tiles', event.error)
|
||||
fail()
|
||||
}
|
||||
gl.on('error', onError)
|
||||
|
||||
Reference in New Issue
Block a user