Add radar tab
This commit is contained in:
parent
4ffb44e107
commit
ddce5c15b3
@ -6,11 +6,12 @@
|
|||||||
import HourlyForecast from './components/HourlyForecast.svelte'
|
import HourlyForecast from './components/HourlyForecast.svelte'
|
||||||
import DailyForecast from './components/DailyForecast.svelte'
|
import DailyForecast from './components/DailyForecast.svelte'
|
||||||
import WeatherDetail from './components/WeatherDetail.svelte'
|
import WeatherDetail from './components/WeatherDetail.svelte'
|
||||||
|
import PrecipitationRadar from './components/PrecipitationRadar.svelte'
|
||||||
import NotificationBell from './components/NotificationBell.svelte'
|
import NotificationBell from './components/NotificationBell.svelte'
|
||||||
import SettingsDialog from './components/SettingsDialog.svelte'
|
import SettingsDialog from './components/SettingsDialog.svelte'
|
||||||
import AddLocationDialog from './components/AddLocationDialog.svelte'
|
import AddLocationDialog from './components/AddLocationDialog.svelte'
|
||||||
|
|
||||||
let viewMode = $state('current') // 'current' | 'hourly' | 'daily' | 'detail'
|
let viewMode = $state('current') // 'current' | 'hourly' | 'daily' | 'detail' | 'radar'
|
||||||
let initDone = $state(false)
|
let initDone = $state(false)
|
||||||
let geoError = $state('')
|
let geoError = $state('')
|
||||||
|
|
||||||
@ -206,6 +207,11 @@
|
|||||||
class:active={viewMode === 'detail'}
|
class:active={viewMode === 'detail'}
|
||||||
onclick={() => viewMode = 'detail'}
|
onclick={() => viewMode = 'detail'}
|
||||||
>More</button>
|
>More</button>
|
||||||
|
<button
|
||||||
|
class="nav-btn"
|
||||||
|
class:active={viewMode === 'radar'}
|
||||||
|
onclick={() => viewMode = 'radar'}
|
||||||
|
>Radar</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Desktop tab bar -->
|
<!-- Desktop tab bar -->
|
||||||
@ -214,6 +220,7 @@
|
|||||||
<button class="tab-btn" class:active={viewMode === 'hourly'} onclick={() => viewMode = 'hourly'}>Hourly</button>
|
<button class="tab-btn" class:active={viewMode === 'hourly'} onclick={() => viewMode = 'hourly'}>Hourly</button>
|
||||||
<button class="tab-btn" class:active={viewMode === 'daily'} onclick={() => viewMode = 'daily'}>7-Day Forecast</button>
|
<button class="tab-btn" class:active={viewMode === 'daily'} onclick={() => viewMode = 'daily'}>7-Day Forecast</button>
|
||||||
<button class="tab-btn" class:active={viewMode === 'detail'} onclick={() => viewMode = 'detail'}>Details</button>
|
<button class="tab-btn" class:active={viewMode === 'detail'} onclick={() => viewMode = 'detail'}>Details</button>
|
||||||
|
<button class="tab-btn" class:active={viewMode === 'radar'} onclick={() => viewMode = 'radar'}>Radar</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Content area -->
|
<!-- Content area -->
|
||||||
@ -234,6 +241,10 @@
|
|||||||
<div class="animate-fade-in">
|
<div class="animate-fade-in">
|
||||||
<WeatherDetail />
|
<WeatherDetail />
|
||||||
</div>
|
</div>
|
||||||
|
{:else if viewMode === 'radar'}
|
||||||
|
<div class="animate-fade-in">
|
||||||
|
<PrecipitationRadar />
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
655
src/components/PrecipitationRadar.svelte
Normal file
655
src/components/PrecipitationRadar.svelte
Normal file
@ -0,0 +1,655 @@
|
|||||||
|
<script>
|
||||||
|
import { app } from '../lib/stores/app.svelte.js'
|
||||||
|
|
||||||
|
// --- Radar data ---
|
||||||
|
let radarData = $state(null)
|
||||||
|
let loading = $state(true)
|
||||||
|
let error = $state('')
|
||||||
|
let currentIdx = $state(0)
|
||||||
|
let playing = $state(false)
|
||||||
|
let zoom = $state(6)
|
||||||
|
let panX = $state(0)
|
||||||
|
let panY = $state(0)
|
||||||
|
let dragging = $state(false)
|
||||||
|
let dragStart = $state({ x: 0, y: 0 })
|
||||||
|
let dragBase = $state({ x: 0, y: 0 })
|
||||||
|
let animRef = null
|
||||||
|
|
||||||
|
const TILE_SIZE = 256
|
||||||
|
const RADAR_COLOR = 4
|
||||||
|
|
||||||
|
const loc = $derived(app.selectedLocation)
|
||||||
|
|
||||||
|
// --- Load radar metadata ---
|
||||||
|
$effect(() => {
|
||||||
|
if (loc) {
|
||||||
|
panX = 0
|
||||||
|
panY = 0
|
||||||
|
loadRadar()
|
||||||
|
}
|
||||||
|
return () => { if (animRef) clearTimeout(animRef) }
|
||||||
|
})
|
||||||
|
|
||||||
|
async function loadRadar() {
|
||||||
|
loading = true
|
||||||
|
error = ''
|
||||||
|
try {
|
||||||
|
const res = await fetch('https://api.rainviewer.com/public/weather-maps.json')
|
||||||
|
if (!res.ok) throw new Error(`Radar API error: ${res.status}`)
|
||||||
|
radarData = await res.json()
|
||||||
|
const pastLen = radarData?.radar?.past?.length || 0
|
||||||
|
if (pastLen > 0) currentIdx = pastLen - 1
|
||||||
|
} catch (e) {
|
||||||
|
error = e.message || 'Failed to load radar'
|
||||||
|
} finally {
|
||||||
|
loading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Frame data ---
|
||||||
|
const pastFrames = $derived(radarData?.radar?.past || [])
|
||||||
|
const nowcastFrames = $derived(radarData?.radar?.nowcast || [])
|
||||||
|
const allFrames = $derived([...pastFrames, ...nowcastFrames])
|
||||||
|
const totalFrames = $derived(allFrames.length)
|
||||||
|
const frame = $derived(allFrames[currentIdx] || null)
|
||||||
|
|
||||||
|
// --- Tile coordinate helpers ---
|
||||||
|
function tileX(lon, z) {
|
||||||
|
return ((lon + 180) / 360) * Math.pow(2, z)
|
||||||
|
}
|
||||||
|
|
||||||
|
function tileY(lat, z) {
|
||||||
|
const rad = (lat * Math.PI) / 180
|
||||||
|
return (1 - Math.log(Math.tan(rad) + 1 / Math.cos(rad)) / Math.PI) * Math.pow(2, z - 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center tile coordinates (floating point, for smooth positioning)
|
||||||
|
const cx = $derived(loc ? tileX(loc.lon, zoom) : 0)
|
||||||
|
const cy = $derived(loc ? tileY(loc.lat, zoom) : 0)
|
||||||
|
|
||||||
|
// Pixel offset of location within the center tile
|
||||||
|
const pxOff = $derived((cx - Math.floor(cx)) * TILE_SIZE)
|
||||||
|
const pyOff = $derived((cy - Math.floor(cy)) * TILE_SIZE)
|
||||||
|
|
||||||
|
// --- Build tile grid (5x5 for panning leeway) ---
|
||||||
|
const tiles = $derived.by(() => {
|
||||||
|
if (!loc) return []
|
||||||
|
const tcx = Math.floor(cx)
|
||||||
|
const tcy = Math.floor(cy)
|
||||||
|
const maxTile = Math.pow(2, zoom)
|
||||||
|
const result = []
|
||||||
|
for (let row = -2; row <= 2; row++) {
|
||||||
|
for (let col = -2; col <= 2; col++) {
|
||||||
|
const tx = tcx + col
|
||||||
|
const ty = tcy + row
|
||||||
|
if (tx < 0 || tx >= maxTile || ty < 0 || ty >= maxTile) continue
|
||||||
|
result.push({
|
||||||
|
tx,
|
||||||
|
ty,
|
||||||
|
col,
|
||||||
|
row,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
function osmUrl(tx, ty) {
|
||||||
|
const s = ['a', 'b', 'c'][(tx + ty) % 3]
|
||||||
|
return `https://${s}.tile.openstreetmap.org/${zoom}/${tx}/${ty}.png`
|
||||||
|
}
|
||||||
|
|
||||||
|
function radarUrl(tx, ty) {
|
||||||
|
if (!frame) return ''
|
||||||
|
return `https://tilecache.rainviewer.com${frame.path}/256/${zoom}/${tx}/${ty}/${RADAR_COLOR}/1_1.png`
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Playback ---
|
||||||
|
function togglePlay() {
|
||||||
|
playing = !playing
|
||||||
|
if (playing) tick()
|
||||||
|
else if (animRef) { clearTimeout(animRef); animRef = null }
|
||||||
|
}
|
||||||
|
|
||||||
|
function tick() {
|
||||||
|
if (!playing || totalFrames === 0) return
|
||||||
|
currentIdx = (currentIdx + 1) % totalFrames
|
||||||
|
animRef = setTimeout(tick, 600)
|
||||||
|
}
|
||||||
|
|
||||||
|
function stepBack() {
|
||||||
|
playing = false; if (animRef) { clearTimeout(animRef); animRef = null }
|
||||||
|
currentIdx = currentIdx > 0 ? currentIdx - 1 : totalFrames - 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function stepForward() {
|
||||||
|
playing = false; if (animRef) { clearTimeout(animRef); animRef = null }
|
||||||
|
currentIdx = (currentIdx + 1) % totalFrames
|
||||||
|
}
|
||||||
|
|
||||||
|
function zoomIn() {
|
||||||
|
if (zoom < 11) { zoom++; panX = 0; panY = 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
function zoomOut() {
|
||||||
|
if (zoom > 2) { zoom--; panX = 0; panY = 0 }
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Pan ---
|
||||||
|
function onPointerDown(e) {
|
||||||
|
// Don't start drag if clicking a button/control
|
||||||
|
if (e.target.closest('button, input')) return
|
||||||
|
dragging = true
|
||||||
|
dragStart = { x: e.clientX, y: e.clientY }
|
||||||
|
dragBase = { x: panX, y: panY }
|
||||||
|
e.currentTarget.setPointerCapture(e.pointerId)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerMove(e) {
|
||||||
|
if (!dragging) return
|
||||||
|
panX = dragBase.x + (e.clientX - dragStart.x)
|
||||||
|
panY = dragBase.y + (e.clientY - dragStart.y)
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPointerUp() {
|
||||||
|
dragging = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Helpers ---
|
||||||
|
function fmtTime(ts) {
|
||||||
|
if (!ts) return ''
|
||||||
|
return new Date(ts * 1000).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmtDate(ts) {
|
||||||
|
if (!ts) return ''
|
||||||
|
return new Date(ts * 1000).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })
|
||||||
|
}
|
||||||
|
|
||||||
|
const isPast = $derived(currentIdx < pastFrames.length)
|
||||||
|
const frameLabel = $derived(isPast ? 'Past' : 'Forecast')
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="radar-section">
|
||||||
|
<h3 class="section-title">Precipitation Radar</h3>
|
||||||
|
|
||||||
|
{#if error && !loc}
|
||||||
|
<div class="radar-status radar-status-err">
|
||||||
|
<span>⚠️ {error}</span>
|
||||||
|
<button class="btn btn-ghost btn-sm" onclick={loadRadar}>Retry</button>
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div
|
||||||
|
class="radar-viewport"
|
||||||
|
class:dragging
|
||||||
|
onpointerdown={onPointerDown}
|
||||||
|
onpointermove={onPointerMove}
|
||||||
|
onpointerup={onPointerUp}
|
||||||
|
onpointerleave={onPointerUp}
|
||||||
|
style="touch-action: none"
|
||||||
|
role="img"
|
||||||
|
aria-label="Precipitation radar map"
|
||||||
|
>
|
||||||
|
<!-- Tile layers (OSM always renders if loc exists) -->
|
||||||
|
{#if loc}
|
||||||
|
<div
|
||||||
|
class="radar-layer"
|
||||||
|
style="transform: translate({panX - pxOff}px, {panY - pyOff}px)"
|
||||||
|
>
|
||||||
|
{#each tiles as t (t.col + '_' + t.row)}
|
||||||
|
<!-- Base map (OSM) -->
|
||||||
|
<img
|
||||||
|
class="radar-tile tile-base"
|
||||||
|
src={osmUrl(t.tx, t.ty)}
|
||||||
|
alt=""
|
||||||
|
loading="lazy"
|
||||||
|
style="grid-column: {t.col + 3}; grid-row: {t.row + 3}"
|
||||||
|
draggable="false"
|
||||||
|
/>
|
||||||
|
<!-- Precipitation overlay -->
|
||||||
|
{#if frame}
|
||||||
|
<img
|
||||||
|
class="radar-tile tile-overlay"
|
||||||
|
src={radarUrl(t.tx, t.ty)}
|
||||||
|
alt=""
|
||||||
|
loading="lazy"
|
||||||
|
style="grid-column: {t.col + 3}; grid-row: {t.row + 3}"
|
||||||
|
draggable="false"
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Location marker -->
|
||||||
|
<div class="location-marker" title={loc?.name || ''}>
|
||||||
|
<span class="marker-dot"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Location label -->
|
||||||
|
{#if loc?.name}
|
||||||
|
<div class="marker-label-badge">{loc.name}</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Loading overlay -->
|
||||||
|
{#if loading}
|
||||||
|
<div class="radar-overlay">
|
||||||
|
<span class="loading-spinner">⏳</span>
|
||||||
|
<span class="text-xs text-muted">Loading radar...</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Error banner (inline) -->
|
||||||
|
{#if error}
|
||||||
|
<div class="radar-error-banner">
|
||||||
|
<span class="text-xs">⚠️ {error}</span>
|
||||||
|
<button class="btn btn-ghost btn-sm" onclick={loadRadar}>Retry</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Zoom controls -->
|
||||||
|
<div class="zoom-ctrl">
|
||||||
|
<button class="zoom-btn" onclick={zoomIn} disabled={zoom >= 11} aria-label="Zoom in">+</button>
|
||||||
|
<span class="zoom-level text-xs text-muted">{zoom}</span>
|
||||||
|
<button class="zoom-btn" onclick={zoomOut} disabled={zoom <= 2} aria-label="Zoom out">−</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Timeline -->
|
||||||
|
{#if frame}
|
||||||
|
<div class="timeline">
|
||||||
|
<div class="tl-controls">
|
||||||
|
<button class="ctrl-btn" onclick={stepBack} aria-label="Previous" title="Previous">⏮</button>
|
||||||
|
<button class="ctrl-btn play-btn" onclick={togglePlay} aria-label={playing ? 'Pause' : 'Play'}>
|
||||||
|
{playing ? '⏸' : '▶'}
|
||||||
|
</button>
|
||||||
|
<button class="ctrl-btn" onclick={stepForward} aria-label="Next" title="Next">⏭</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tl-slider">
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max={totalFrames - 1}
|
||||||
|
value={currentIdx}
|
||||||
|
oninput={(e) => {
|
||||||
|
playing = false
|
||||||
|
if (animRef) { clearTimeout(animRef); animRef = null }
|
||||||
|
currentIdx = Number(e.target.value)
|
||||||
|
}}
|
||||||
|
aria-label="Radar timeline"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tl-info">
|
||||||
|
<span class="tl-time">{fmtTime(frame.time)}</span>
|
||||||
|
<span class="tl-date text-muted">{fmtDate(frame.time)}</span>
|
||||||
|
<span class="tl-badge" class:tl-past={isPast} class:tl-future={!isPast}>{frameLabel}</span>
|
||||||
|
<span class="text-muted text-xs">{currentIdx + 1}/{totalFrames}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{:else if !loading}
|
||||||
|
<div class="radar-status">
|
||||||
|
<p class="text-muted">No radar data available.</p>
|
||||||
|
<button class="btn btn-ghost btn-sm" onclick={loadRadar}>Reload</button>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.radar-section {
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
color: var(--color-text-secondary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.radar-status,
|
||||||
|
.radar-status-err {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 48px 16px;
|
||||||
|
background: var(--color-surface-card);
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radar-status-err {
|
||||||
|
border-color: rgba(239, 68, 68, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Loading overlay on top of map */
|
||||||
|
.radar-overlay {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(10, 22, 40, 0.75);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 8px;
|
||||||
|
z-index: 10;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Error banner on top of map */
|
||||||
|
.radar-error-banner {
|
||||||
|
position: absolute;
|
||||||
|
top: 12px;
|
||||||
|
left: 12px;
|
||||||
|
right: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 8px 12px;
|
||||||
|
background: rgba(239, 68, 68, 0.15);
|
||||||
|
border: 1px solid rgba(239, 68, 68, 0.3);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
z-index: 10;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-spinner {
|
||||||
|
font-size: 2rem;
|
||||||
|
animation: spin 1.5s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes spin {
|
||||||
|
from { transform: rotate(0deg); }
|
||||||
|
to { transform: rotate(360deg); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Viewport ── */
|
||||||
|
.radar-viewport {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 420px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #aad3df;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
cursor: grab;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radar-viewport.dragging {
|
||||||
|
cursor: grabbing;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radar-layer {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(5, 256px);
|
||||||
|
grid-template-rows: repeat(5, 256px);
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -640px;
|
||||||
|
margin-top: -640px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radar-tile {
|
||||||
|
width: 256px;
|
||||||
|
height: 256px;
|
||||||
|
display: block;
|
||||||
|
pointer-events: none;
|
||||||
|
grid-area: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile-base {
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tile-overlay {
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Location marker ── */
|
||||||
|
.location-marker {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-dot {
|
||||||
|
display: block;
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
background: var(--color-primary);
|
||||||
|
border: 3px solid #fff;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 0 12px rgba(56, 189, 248, 0.7);
|
||||||
|
animation: marker-pulse 2s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes marker-pulse {
|
||||||
|
0%, 100% { box-shadow: 0 0 8px rgba(56, 189, 248, 0.4); }
|
||||||
|
50% { box-shadow: 0 0 20px rgba(56, 189, 248, 0.9); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-label-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(50% + 12px);
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: rgba(0, 0, 0, 0.75);
|
||||||
|
color: #fff;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Zoom controls ── */
|
||||||
|
.zoom-ctrl {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 12px;
|
||||||
|
right: 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
z-index: 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-btn {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
background: var(--color-surface);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-btn:hover:not(:disabled) {
|
||||||
|
background: var(--color-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-btn:disabled {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-level {
|
||||||
|
padding: 2px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Timeline ── */
|
||||||
|
.timeline {
|
||||||
|
margin-top: 12px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
background: var(--color-surface-card);
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-lg);
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-controls {
|
||||||
|
display: flex;
|
||||||
|
gap: 4px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctrl-btn {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
background: var(--color-surface);
|
||||||
|
color: var(--color-text);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: background var(--transition);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctrl-btn:hover {
|
||||||
|
background: var(--color-surface-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-btn {
|
||||||
|
width: 38px;
|
||||||
|
height: 38px;
|
||||||
|
background: var(--color-primary);
|
||||||
|
border-color: var(--color-primary);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-btn:hover {
|
||||||
|
background: var(--color-primary-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-slider {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 120px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-slider input[type='range'] {
|
||||||
|
width: 100%;
|
||||||
|
height: 6px;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
background: var(--color-border);
|
||||||
|
border-radius: 3px;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-slider input[type='range']::-webkit-slider-thumb {
|
||||||
|
-webkit-appearance: none;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--color-primary);
|
||||||
|
border: 2px solid #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-slider input[type='range']::-moz-range-thumb {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--color-primary);
|
||||||
|
border: 2px solid #fff;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
width: 100%;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-time {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
color: var(--color-primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-date {
|
||||||
|
font-size: 0.82rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-badge {
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-past {
|
||||||
|
background: rgba(96, 165, 250, 0.15);
|
||||||
|
color: var(--color-rain);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tl-future {
|
||||||
|
background: rgba(52, 211, 153, 0.15);
|
||||||
|
color: var(--color-success);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Responsive ── */
|
||||||
|
@media (max-width: 1023px) {
|
||||||
|
.radar-viewport {
|
||||||
|
height: 320px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline {
|
||||||
|
padding: 10px 12px;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.radar-viewport {
|
||||||
|
height: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.zoom-btn {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ctrl-btn {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.play-btn {
|
||||||
|
width: 34px;
|
||||||
|
height: 34px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user