Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

feat(globe): globe enchantments (#261)

Timothy Yin133236ebeec4
diff --git a/app/components/map/PhotoPin.vue b/app/components/map/PhotoPin.vue
index 5a483ce4..3591980e 100644
--- a/app/components/map/PhotoPin.vue
+++ b/app/components/map/PhotoPin.vue
@@ -9,10 +9,12 @@ const props = withDefaults(
clusterPoint: ClusterPoint
isSelected?: boolean
markerId?: string
+ analysisMode?: 'none' | 'focalLength' | 'shutterSpeed' | 'altitude'
}>(),
{
isSelected: false,
markerId: undefined,
+ analysisMode: 'none',
},
)
@@ -25,6 +27,209 @@ const dayjs = useDayjs()
const marker = computed(() => props.clusterPoint.properties.marker!)
const hoverOpen = ref(false)
+const parseExifNumber = (value: unknown): number | null => {
+ if (typeof value === 'number') {
+ return Number.isFinite(value) ? value : null
+ }
+
+ if (typeof value !== 'string') {
+ return null
+ }
+
+ const trimmed = value.trim()
+ if (!trimmed) {
+ return null
+ }
+
+ const fractionMatch = trimmed.match(/^(-?\d+(?:\.\d+)?)\s*\/\s*(-?\d+(?:\.\d+)?)$/)
+ if (fractionMatch) {
+ const numerator = Number(fractionMatch[1])
+ const denominator = Number(fractionMatch[2])
+ if (!Number.isFinite(numerator) || !Number.isFinite(denominator) || denominator === 0) {
+ return null
+ }
+ return numerator / denominator
+ }
+
+ const numericMatch = trimmed.match(/-?\d+(?:\.\d+)?/)
+ if (!numericMatch) {
+ return null
+ }
+
+ const parsed = Number(numericMatch[0])
+ return Number.isFinite(parsed) ? parsed : null
+}
+
+const focalLengthValue = computed(() => {
+ return parseExifNumber(
+ marker.value.exif?.FocalLengthIn35mmFormat ?? marker.value.exif?.FocalLength,
+ )
+})
+
+const shutterSecondsValue = computed(() => {
+ return parseExifNumber(marker.value.exif?.ExposureTime)
+})
+
+const altitudeValue = computed(() => {
+ const altitude = parseExifNumber(marker.value.exif?.GPSAltitude)
+ if (altitude === null) {
+ return null
+ }
+
+ const isBelowSeaLevel = marker.value.exif?.GPSAltitudeRef === 'Below Sea Level'
+ return isBelowSeaLevel ? -Math.abs(altitude) : altitude
+})
+
+type AnalysisBucket = 'low' | 'mid' | 'high' | null
+
+const analysisBucket = computed<AnalysisBucket>(() => {
+ if (props.analysisMode === 'none') {
+ return null
+ }
+
+ if (props.analysisMode === 'focalLength') {
+ const value = focalLengthValue.value
+ if (value === null) {
+ return null
+ }
+ if (value < 35) return 'low'
+ if (value <= 85) return 'mid'
+ return 'high'
+ }
+
+ if (props.analysisMode === 'shutterSpeed') {
+ const value = shutterSecondsValue.value
+ if (value === null) {
+ return null
+ }
+ if (value <= 1 / 250) return 'low'
+ if (value <= 1 / 30) return 'mid'
+ return 'high'
+ }
+
+ const value = altitudeValue.value
+ if (value === null) {
+ return null
+ }
+ if (value < 200) return 'low'
+ if (value <= 1500) return 'mid'
+ return 'high'
+})
+
+const analysisVisual = computed(() => {
+ if (props.analysisMode === 'none' || !analysisBucket.value) {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-green/40 to-emerald/60 dark:from-green/60 dark:to-emerald/80',
+ pinClass:
+ 'border-white/50 bg-white/80 hover:bg-white/90 dark:border-white/30 dark:bg-black/80 dark:hover:bg-black/90',
+ ringClass: '',
+ badgeClass: '',
+ badgeLabel: '',
+ }
+ }
+
+ if (props.analysisMode === 'focalLength') {
+ if (analysisBucket.value === 'low') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-cyan-300/45 to-sky-500/60 dark:from-cyan-300/55 dark:to-sky-500/75',
+ pinClass:
+ 'border-cyan-300/70 bg-cyan-50/85 hover:bg-cyan-100/85 dark:border-cyan-300/45 dark:bg-cyan-900/45 dark:hover:bg-cyan-900/60',
+ ringClass: 'ring-cyan-400/45 dark:ring-cyan-300/45',
+ badgeClass: 'bg-cyan-500/90 text-white',
+ badgeLabel: 'W',
+ }
+ }
+ if (analysisBucket.value === 'mid') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-amber-300/45 to-orange-500/60 dark:from-amber-300/55 dark:to-orange-500/75',
+ pinClass:
+ 'border-amber-300/70 bg-amber-50/85 hover:bg-amber-100/85 dark:border-amber-300/45 dark:bg-amber-900/45 dark:hover:bg-amber-900/60',
+ ringClass: 'ring-amber-400/45 dark:ring-amber-300/45',
+ badgeClass: 'bg-amber-500/90 text-white',
+ badgeLabel: 'N',
+ }
+ }
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-rose-300/45 to-pink-500/60 dark:from-rose-300/55 dark:to-pink-500/75',
+ pinClass:
+ 'border-rose-300/70 bg-rose-50/85 hover:bg-rose-100/85 dark:border-rose-300/45 dark:bg-rose-900/45 dark:hover:bg-rose-900/60',
+ ringClass: 'ring-rose-400/45 dark:ring-rose-300/45',
+ badgeClass: 'bg-rose-500/90 text-white',
+ badgeLabel: 'T',
+ }
+ }
+
+ if (props.analysisMode === 'shutterSpeed') {
+ if (analysisBucket.value === 'low') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-emerald-300/45 to-green-500/60 dark:from-emerald-300/55 dark:to-green-500/75',
+ pinClass:
+ 'border-emerald-300/70 bg-emerald-50/85 hover:bg-emerald-100/85 dark:border-emerald-300/45 dark:bg-emerald-900/45 dark:hover:bg-emerald-900/60',
+ ringClass: 'ring-emerald-400/45 dark:ring-emerald-300/45',
+ badgeClass: 'bg-emerald-500/90 text-white',
+ badgeLabel: 'F',
+ }
+ }
+ if (analysisBucket.value === 'mid') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-amber-300/45 to-yellow-500/60 dark:from-amber-300/55 dark:to-yellow-500/75',
+ pinClass:
+ 'border-amber-300/70 bg-amber-50/85 hover:bg-amber-100/85 dark:border-amber-300/45 dark:bg-amber-900/45 dark:hover:bg-amber-900/60',
+ ringClass: 'ring-amber-400/45 dark:ring-amber-300/45',
+ badgeClass: 'bg-amber-500/90 text-white',
+ badgeLabel: 'M',
+ }
+ }
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-indigo-300/45 to-violet-500/60 dark:from-indigo-300/55 dark:to-violet-500/75',
+ pinClass:
+ 'border-indigo-300/70 bg-indigo-50/85 hover:bg-indigo-100/85 dark:border-indigo-300/45 dark:bg-indigo-900/45 dark:hover:bg-indigo-900/60',
+ ringClass: 'ring-indigo-400/45 dark:ring-indigo-300/45',
+ badgeClass: 'bg-indigo-500/90 text-white',
+ badgeLabel: 'S',
+ }
+ }
+
+ if (analysisBucket.value === 'low') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-lime-300/45 to-green-500/60 dark:from-lime-300/55 dark:to-green-500/75',
+ pinClass:
+ 'border-lime-300/70 bg-lime-50/85 hover:bg-lime-100/85 dark:border-lime-300/45 dark:bg-lime-900/45 dark:hover:bg-lime-900/60',
+ ringClass: 'ring-lime-400/45 dark:ring-lime-300/45',
+ badgeClass: 'bg-lime-500/90 text-white',
+ badgeLabel: 'L',
+ }
+ }
+ if (analysisBucket.value === 'mid') {
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-orange-300/45 to-amber-500/60 dark:from-orange-300/55 dark:to-amber-500/75',
+ pinClass:
+ 'border-orange-300/70 bg-orange-50/85 hover:bg-orange-100/85 dark:border-orange-300/45 dark:bg-orange-900/45 dark:hover:bg-orange-900/60',
+ ringClass: 'ring-orange-400/45 dark:ring-orange-300/45',
+ badgeClass: 'bg-orange-500/90 text-white',
+ badgeLabel: 'M',
+ }
+ }
+ return {
+ overlayClass:
+ 'bg-linear-to-br from-fuchsia-300/45 to-pink-500/60 dark:from-fuchsia-300/55 dark:to-pink-500/75',
+ pinClass:
+ 'border-fuchsia-300/70 bg-fuchsia-50/85 hover:bg-fuchsia-100/85 dark:border-fuchsia-300/45 dark:bg-fuchsia-900/45 dark:hover:bg-fuchsia-900/60',
+ ringClass: 'ring-fuchsia-400/45 dark:ring-fuchsia-300/45',
+ badgeClass: 'bg-fuchsia-500/90 text-white',
+ badgeLabel: 'H',
+ }
+})
+
const hoverCardOpen = computed({
get: () => (props.isSelected ? true : hoverOpen.value),
set: (value: boolean) => {
@@ -90,7 +295,10 @@ const onClick = () => {
v-if="isSelected"
class="bg-primary/20 dark:bg-primary/30 absolute -inset-1 animate-pulse rounded-full"
/>
-
+ <div
+ v-if="isSelected"
+ class="absolute -inset-2 rounded-full border border-primary/40 dark:border-primary/50 animate-ping"
+ />
<div class="absolute inset-0 overflow-hidden rounded-full">
<ThumbImage
:src="marker.thumbnailUrl!"
@@ -101,7 +309,7 @@ const onClick = () => {
class="h-full w-full object-cover opacity-50"
/>
<div
- class="absolute inset-0 bg-linear-to-br from-green/40 to-emerald/60 dark:from-green/60 dark:to-emerald/80"
+ :class="twMerge('absolute inset-0', analysisVisual.overlayClass)"
/>
</div>
@@ -112,7 +320,7 @@ const onClick = () => {
'relative size-10 flex justify-center items-center rounded-full border shadow-lg hover:shadow-xl',
isSelected
? 'border-primary/60 bg-primary/80 shadow-primary/30 dark:border-primary/40 dark:bg-primary/90 dark:shadow-primary/50'
- : 'border-white/50 bg-white/80 hover:bg-white/90 dark:border-white/30 dark:bg-black/80 dark:hover:bg-black/90',
+ : analysisVisual.pinClass,
)
"
>
@@ -123,6 +331,17 @@ const onClick = () => {
name="tabler:photo"
class="size-5 text-neutral-700 dark:text-white drop-shadow"
/>
+ <span
+ v-if="props.analysisMode !== 'none' && analysisBucket"
+ :class="
+ twMerge(
+ 'absolute -top-1 -right-1 size-4 rounded-full text-[9px] font-bold leading-none inline-flex items-center justify-center border border-white/70 dark:border-white/20 shadow-sm',
+ analysisVisual.badgeClass,
+ )
+ "
+ >
+ {{ analysisVisual.badgeLabel }}
+ </span>
<div
class="absolute inset-0 rounded-full shadow-inner shadow-black/5"
/>
diff --git a/app/components/ui/GlassButton.vue b/app/components/ui/GlassButton.vue
index ea3c5be8..430218d1 100644
--- a/app/components/ui/GlassButton.vue
+++ b/app/components/ui/GlassButton.vue
@@ -12,12 +12,14 @@ withDefaults(
size?: 'sm' | 'md' | 'lg'
rounded?: boolean
icon?: string
+ active?: boolean
}>(),
{
class: '',
size: 'md',
rounded: false,
icon: '',
+ active: false,
},
)
@@ -45,6 +47,9 @@ const iconSizeClasses = {
:class="
twMerge(
'px-2 cursor-pointer pointer-events-auto font-medium flex items-center justify-center gap-1.5 bg-white/30 text-neutral-700 backdrop-blur-md border border-neutral-100 shadow-md shadow-neutral-300/20 dark:bg-neutral-700/30 dark:text-white/80 dark:border-white/10 dark:shadow-black/20 overflow-hidden',
+ $props.active
+ ? 'bg-primary/25 text-primary-700 border-primary/60 shadow-[0_0_0_1px_rgba(59,130,246,0.25),0_0_18px_rgba(59,130,246,0.35)] dark:bg-primary/30 dark:text-primary-200 dark:border-primary/50 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.3),0_0_20px_rgba(59,130,246,0.4)]'
+ : '',
sizeClasses[$props.size!],
$props.rounded ? 'rounded-full' : 'rounded-xl',
$props.class,
diff --git a/app/pages/globe.vue b/app/pages/globe.vue
index 95038fb5..0ed1c900 100644
--- a/app/pages/globe.vue
+++ b/app/pages/globe.vue
@@ -8,6 +8,7 @@ useHead({
const route = useRoute()
const router = useRouter()
+const dayjs = useDayjs()
const { photos } = usePhotos()
@@ -21,13 +22,324 @@ const photosWithLocation = computed(() => {
)
})
+const timelineProgress = ref(100)
+const isTimelineEnabled = ref(false)
+const isTimelinePlaying = ref(false)
+const isTimelineDragging = ref(false)
+const timelineTrackRef = ref<HTMLElement | null>(null)
+const timelinePlayDurationMs = 12000
+let timelineAnimationFrame: number | null = null
+let timelineLastTick = 0
+
+const datedPhotosWithLocation = computed(() => {
+ return photosWithLocation.value
+ .map((photo) => {
+ const timestamp = photo.dateTaken
+ ? new Date(photo.dateTaken).getTime()
+ : Number.NaN
+ return {
+ photo,
+ timestamp,
+ }
+ })
+ .filter((entry) => Number.isFinite(entry.timestamp))
+ .sort((a, b) => a.timestamp - b.timestamp)
+})
+
+const hasTimelineData = computed(() => datedPhotosWithLocation.value.length > 1)
+
+const timelineRange = computed(() => {
+ if (!hasTimelineData.value) {
+ return null
+ }
+
+ const first = datedPhotosWithLocation.value[0]!
+ const last = datedPhotosWithLocation.value[datedPhotosWithLocation.value.length - 1]!
+ return {
+ min: first.timestamp,
+ max: last.timestamp,
+ }
+})
+
+const timelineCutoffTimestamp = computed(() => {
+ if (!timelineRange.value) {
+ return null
+ }
+
+ const ratio = timelineProgress.value / 100
+ return Math.round(
+ timelineRange.value.min +
+ (timelineRange.value.max - timelineRange.value.min) * ratio,
+ )
+})
+
+const filteredPhotosWithLocation = computed(() => {
+ if (!isTimelineEnabled.value) {
+ return photosWithLocation.value
+ }
+
+ if (!timelineCutoffTimestamp.value) {
+ return photosWithLocation.value
+ }
+
+ return photosWithLocation.value.filter((photo) => {
+ if (!photo.dateTaken) {
+ return true
+ }
+ const timestamp = new Date(photo.dateTaken).getTime()
+ if (!Number.isFinite(timestamp)) {
+ return true
+ }
+ return timestamp <= timelineCutoffTimestamp.value!
+ })
+})
+
+const timelineStartLabel = computed(() => {
+ if (!timelineRange.value) {
+ return '--'
+ }
+ return dayjs(timelineRange.value.min).format('YYYY-MM-DD')
+})
+
+const timelineEndLabel = computed(() => {
+ if (!timelineRange.value) {
+ return '--'
+ }
+ return dayjs(timelineRange.value.max).format('YYYY-MM-DD')
+})
+
+const timelineCurrentLabel = computed(() => {
+ if (!timelineCutoffTimestamp.value) {
+ return '--'
+ }
+ return dayjs(timelineCutoffTimestamp.value).format('YYYY-MM-DD')
+})
+
+const timelineProgressStyle = computed(() => `${timelineProgress.value}%`)
+
+const clampProgress = (value: number) => {
+ return Math.min(100, Math.max(0, value))
+}
+
+const updateTimelineProgressByClientX = (clientX: number) => {
+ if (!timelineTrackRef.value) {
+ return
+ }
+
+ const rect = timelineTrackRef.value.getBoundingClientRect()
+ if (rect.width <= 0) {
+ return
+ }
+
+ const ratio = (clientX - rect.left) / rect.width
+ timelineProgress.value = clampProgress(ratio * 100)
+}
+
+const stopTimelineDragging = () => {
+ isTimelineDragging.value = false
+ window.removeEventListener('pointermove', onTimelinePointerMove)
+ window.removeEventListener('pointerup', onTimelinePointerUp)
+}
+
+const onTimelinePointerMove = (event: PointerEvent) => {
+ if (!isTimelineDragging.value) {
+ return
+ }
+ updateTimelineProgressByClientX(event.clientX)
+}
+
+const onTimelinePointerUp = () => {
+ stopTimelineDragging()
+}
+
+const onTimelinePointerDown = (event: PointerEvent) => {
+ if (!isTimelineEnabled.value || !hasTimelineData.value) {
+ return
+ }
+
+ stopTimelinePlayback()
+ isTimelineDragging.value = true
+ updateTimelineProgressByClientX(event.clientX)
+ window.addEventListener('pointermove', onTimelinePointerMove)
+ window.addEventListener('pointerup', onTimelinePointerUp)
+}
+
+const stopTimelinePlayback = () => {
+ isTimelinePlaying.value = false
+ if (timelineAnimationFrame !== null) {
+ cancelAnimationFrame(timelineAnimationFrame)
+ timelineAnimationFrame = null
+ }
+}
+
+const tickTimelinePlayback = (now: number) => {
+ if (!isTimelinePlaying.value) {
+ return
+ }
+
+ const delta = now - timelineLastTick
+ timelineLastTick = now
+
+ const progressDelta = (delta / timelinePlayDurationMs) * 100
+ const nextProgress = clampProgress(timelineProgress.value + progressDelta)
+ timelineProgress.value = nextProgress
+
+ if (nextProgress >= 100) {
+ stopTimelinePlayback()
+ return
+ }
+
+ timelineAnimationFrame = requestAnimationFrame(tickTimelinePlayback)
+}
+
+const startTimelinePlayback = () => {
+ if (!hasTimelineData.value) {
+ return
+ }
+
+ if (timelineProgress.value >= 100) {
+ timelineProgress.value = 0
+ }
+
+ isTimelinePlaying.value = true
+ timelineLastTick = performance.now()
+ timelineAnimationFrame = requestAnimationFrame(tickTimelinePlayback)
+}
+
+const toggleTimelinePlayback = () => {
+ if (!isTimelineEnabled.value) {
+ return
+ }
+
+ if (isTimelinePlaying.value) {
+ stopTimelinePlayback()
+ return
+ }
+ startTimelinePlayback()
+}
+
+const toggleTimelineEnabled = () => {
+ if (isTimelineEnabled.value) {
+ stopTimelineDragging()
+ stopTimelinePlayback()
+ isTimelineEnabled.value = false
+ return
+ }
+
+ isTimelineEnabled.value = true
+}
+
const currentClusterPointId = ref<string | null>(null)
const mapInstance = ref<any>(null)
const currentZoom = ref<number>(4)
+const analysisMode = ref<'none' | 'focalLength' | 'shutterSpeed' | 'altitude'>(
+ 'none',
+)
+const parameterAnnotationOpen = ref(false)
+
+const analysisModeOptions = [
+ {
+ value: 'none',
+ label: '默认',
+ icon: 'tabler:circle-off',
+ description: '关闭标注',
+ },
+ {
+ value: 'focalLength',
+ label: '焦段',
+ icon: 'tabler:zoom-scan',
+ description: '广角 / 标准 / 长焦',
+ },
+ {
+ value: 'shutterSpeed',
+ label: '快门',
+ icon: 'tabler:clock-hour-4',
+ description: '高速 / 中速 / 低速',
+ },
+ {
+ value: 'altitude',
+ label: '海拔',
+ icon: 'tabler:mountain',
+ description: '低 / 中 / 高海拔',
+ },
+] as const
+
+const analysisLegend = computed(() => {
+ if (analysisMode.value === 'focalLength') {
+ return {
+ title: '焦段分布',
+ items: [
+ {
+ label: '广角',
+ range: '<35mm',
+ color: 'bg-cyan-500',
+ },
+ {
+ label: '标准',
+ range: '35-85mm',
+ color: 'bg-amber-500',
+ },
+ {
+ label: '长焦',
+ range: '>85mm',
+ color: 'bg-rose-500',
+ },
+ ],
+ }
+ }
+
+ if (analysisMode.value === 'shutterSpeed') {
+ return {
+ title: '快门分布',
+ items: [
+ {
+ label: '高速',
+ range: '≤1/250s',
+ color: 'bg-emerald-500',
+ },
+ {
+ label: '中速',
+ range: '1/250-1/30s',
+ color: 'bg-amber-500',
+ },
+ {
+ label: '低速',
+ range: '>1/30s',
+ color: 'bg-indigo-500',
+ },
+ ],
+ }
+ }
+
+ if (analysisMode.value === 'altitude') {
+ return {
+ title: '海拔分布',
+ items: [
+ {
+ label: '低海拔',
+ range: '<200m',
+ color: 'bg-lime-500',
+ },
+ {
+ label: '中海拔',
+ range: '200-1500m',
+ color: 'bg-orange-500',
+ },
+ {
+ label: '高海拔',
+ range: '>1500m',
+ color: 'bg-fuchsia-500',
+ },
+ ],
+ }
+ }
+
+ return null
+})
// Convert photos to markers and apply clustering
const clusteredMarkers = computed(() => {
- const markers = photosToMarkers(photosWithLocation.value)
+ const markers = photosToMarkers(filteredPhotosWithLocation.value)
return clusterMarkers(markers, currentZoom.value)
})
@@ -53,6 +365,17 @@ watch(currentClusterPointId, (newId) => {
}
})
+watch(filteredPhotosWithLocation, (currentPhotos) => {
+ if (!currentClusterPointId.value) {
+ return
+ }
+
+ const exists = currentPhotos.some((photo) => photo.id === currentClusterPointId.value)
+ if (!exists) {
+ currentClusterPointId.value = null
+ }
+})
+
const mapViewState = computed(() => {
if (photosWithLocation.value.length === 0) {
return {
@@ -199,11 +522,18 @@ const generateRandomKey = () => {
}
onBeforeRouteLeave(() => {
+ stopTimelineDragging()
+ stopTimelinePlayback()
if (mapInstance.value) {
mapInstance.value.remove()
mapInstance.value = null
}
})
+
+onBeforeUnmount(() => {
+ stopTimelineDragging()
+ stopTimelinePlayback()
+})
</script>
<template>
@@ -214,6 +544,128 @@ onBeforeRouteLeave(() => {
@click="$router.push('/')"
/>
+ <div class="absolute top-4 right-4 z-10 flex flex-col items-end">
+ <div class="relative">
+ <UTooltip
+ text="拍摄参数标注"
+ :delay-duration="0"
+ >
+ <GlassButton
+ icon="tabler:adjustments"
+ :active="analysisMode !== 'none'"
+ @click="parameterAnnotationOpen = !parameterAnnotationOpen"
+ />
+ </UTooltip>
+
+ <AnimatePresence>
+ <motion.div
+ v-if="parameterAnnotationOpen"
+ :initial="{ opacity: 0, y: -8, scale: 0.96 }"
+ :animate="{ opacity: 1, y: 0, scale: 1 }"
+ :exit="{ opacity: 0, y: -8, scale: 0.96 }"
+ :transition="{ duration: 0.2, ease: 'easeOut' }"
+ class="absolute right-0 top-full mt-2 z-40 w-64 origin-top-right overflow-hidden rounded-xl border border-neutral-100 bg-white/30 text-neutral-700 shadow-md shadow-neutral-300/20 backdrop-blur-md dark:border-white/10 dark:bg-neutral-700/30 dark:text-white/80 dark:shadow-black/20"
+ >
+ <div
+ class="px-3 py-2 border-b border-neutral-100/80 dark:border-white/10"
+ >
+ <div class="flex items-center gap-2 text-sm font-semibold">
+ <Icon
+ name="tabler:adjustments-horizontal"
+ class="size-4 text-primary"
+ />
+ <span>拍摄参数标注</span>
+ </div>
+ <p class="mt-1 text-[11px] text-neutral-600 dark:text-white/60">
+ 按拍摄参数查看地理分布
+ </p>
+ </div>
+
+ <div class="p-2.5 space-y-2">
+ <button
+ v-for="mode in analysisModeOptions"
+ :key="mode.value"
+ type="button"
+ :class="[
+ 'w-full px-2.5 py-2 rounded-lg text-left transition-colors border flex items-center gap-2.5',
+ analysisMode === mode.value
+ ? 'bg-primary/90 text-white border-primary/70 shadow-sm'
+ : 'bg-white/15 text-neutral-700 dark:text-white/80 border-neutral-200/70 dark:border-white/10 hover:bg-white/30 dark:hover:bg-black/20',
+ ]"
+ @click="analysisMode = mode.value"
+ >
+ <span
+ :class="[
+ 'size-7 rounded-md flex items-center justify-center shrink-0 border',
+ analysisMode === mode.value
+ ? 'bg-white/20 border-white/30'
+ : 'bg-white/30 dark:bg-black/20 border-neutral-200/60 dark:border-white/10',
+ ]"
+ >
+ <Icon
+ :name="mode.icon"
+ class="size-4"
+ />
+ </span>
+ <span class="min-w-0">
+ <span class="block text-xs font-semibold leading-none">{{
+ mode.label
+ }}</span>
+ <span
+ class="block text-[10px] mt-1 text-neutral-500 dark:text-white/55"
+ >
+ {{ mode.description }}
+ </span>
+ </span>
+ </button>
+ </div>
+
+ <div
+ v-if="analysisLegend"
+ class="mx-2.5 mb-2.5 rounded-lg border border-neutral-200/70 dark:border-white/10 bg-white/25 dark:bg-black/20 p-2"
+ >
+ <div
+ class="text-[10px] font-semibold text-neutral-600 dark:text-white/70 px-1 mb-1"
+ >
+ {{ analysisLegend.title }}
+ </div>
+ <div
+ v-for="item in analysisLegend.items"
+ :key="item.label"
+ class="flex items-center justify-between gap-2 text-[10px] text-neutral-700 dark:text-white/80 px-1 py-1 rounded-md hover:bg-white/40 dark:hover:bg-black/20"
+ >
+ <span class="inline-flex items-center gap-1.5 min-w-0">
+ <span
+ :class="[
+ 'size-2.5 rounded-full shrink-0 ring-1 ring-black/10 dark:ring-white/20',
+ item.color,
+ ]"
+ />
+ <span class="truncate">{{ item.label }}</span>
+ </span>
+ <span class="font-mono text-neutral-500 dark:text-white/55">{{
+ item.range
+ }}</span>
+ </div>
+ </div>
+ </motion.div>
+ </AnimatePresence>
+ </div>
+
+ <div class="mt-2 relative">
+ <UTooltip
+ text="启用/关闭时间回溯"
+ :delay-duration="0"
+ >
+ <GlassButton
+ icon="tabler:timeline-event"
+ :active="isTimelineEnabled"
+ @click="toggleTimelineEnabled"
+ />
+ </UTooltip>
+ </div>
+ </div>
+
<div class="absolute bottom-4 left-4 z-10 flex flex-col">
<!-- Zoom in -->
<GlassButton
@@ -235,6 +687,72 @@ onBeforeRouteLeave(() => {
/>
</div>
+ <div
+ v-if="isTimelineEnabled"
+ class="absolute bottom-4 left-1/2 -translate-x-1/2 z-10 w-[min(92vw,54rem)] max-sm:left-3 max-sm:right-3 max-sm:translate-x-0 max-sm:w-auto max-sm:pl-16"
+ >
+ <div
+ class="rounded-xl border border-neutral-100 bg-white/30 text-neutral-700 shadow-md shadow-neutral-300/20 backdrop-blur-md dark:border-white/10 dark:bg-neutral-700/30 dark:text-white/80 dark:shadow-black/20 px-3 py-2"
+ >
+ <div class="flex items-center gap-2">
+ <UTooltip
+ text="播放/暂停时间回溯"
+ :delay-duration="0"
+ >
+ <GlassButton
+ size="sm"
+ :icon="isTimelinePlaying ? 'tabler:player-pause' : 'tabler:player-play'"
+ :class="
+ !hasTimelineData || !isTimelineEnabled
+ ? 'opacity-40 pointer-events-none'
+ : ''
+ "
+ @click="toggleTimelinePlayback"
+ />
+ </UTooltip>
+ <div class="min-w-0 flex-1">
+ <div class="flex items-center justify-between gap-2 text-[11px]">
+ <span class="font-medium">时间回溯</span>
+ <span class="text-neutral-600 dark:text-white/60">
+ {{ filteredPhotosWithLocation.length }}/{{ photosWithLocation.length }}
+ </span>
+ </div>
+ <div
+ ref="timelineTrackRef"
+ :class="[
+ 'mt-2 relative h-5 select-none touch-none',
+ hasTimelineData
+ ? 'cursor-pointer'
+ : 'cursor-not-allowed opacity-60',
+ ]"
+ @pointerdown="onTimelinePointerDown"
+ >
+ <div
+ class="absolute left-0 right-0 top-1/2 -translate-y-1/2 h-1 rounded-full bg-neutral-200/80 dark:bg-white/15"
+ />
+ <div
+ class="absolute left-0 top-1/2 -translate-y-1/2 h-1 rounded-full bg-linear-to-r from-neutral-200/85 via-white/95 to-neutral-200/85 dark:from-white/35 dark:via-white/90 dark:to-white/35 shadow-[0_0_10px_rgba(255,255,255,0.35)]"
+ :style="{ width: timelineProgressStyle }"
+ />
+ <div
+ class="absolute top-1/2 -translate-y-1/2 h-3 w-1.5 rounded-sm border border-white/90 bg-white shadow-[0_0_0_1px_rgba(255,255,255,0.45),0_0_10px_rgba(255,255,255,0.55)] dark:border-white/70 dark:bg-white/95 dark:shadow-[0_0_0_1px_rgba(255,255,255,0.2),0_0_8px_rgba(255,255,255,0.45)]"
+ :style="{ left: `calc(${timelineProgressStyle} - 0.1875rem)` }"
+ />
+ </div>
+ <div
+ class="mt-1 flex items-center justify-between gap-2 text-[10px] text-neutral-500 dark:text-white/55 font-mono"
+ >
+ <span>{{ timelineStartLabel }}</span>
+ <span class="text-neutral-700 dark:text-white/80">{{
+ timelineCurrentLabel
+ }}</span>
+ <span>{{ timelineEndLabel }}</span>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
<motion.div
:initial="{ opacity: 0, scale: 1.08 }"
:animate="{ opacity: 1, scale: 1 }"
@@ -274,6 +792,7 @@ onBeforeRouteLeave(() => {
:is-selected="
clusterPoint.properties.marker?.id === currentClusterPointId
"
+ :analysis-mode="analysisMode"
:marker-id="generateRandomKey()"
@click="onMarkerPinClick"
@close="onMarkerPinClose"