From 2dc35687fa13edfe627cab906e8311e4728d74bc Mon Sep 17 00:00:00 2001 From: artem Date: Thu, 17 Sep 2026 20:35:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=84=D0=BE=D1=82=D0=BE=D0=B3=D1=80=D0=B0=D1=84=D0=B8?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/workouts/components/WorkoutItem.vue | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/pages/workouts/components/WorkoutItem.vue b/src/pages/workouts/components/WorkoutItem.vue index 9338ad6..00d4461 100644 --- a/src/pages/workouts/components/WorkoutItem.vue +++ b/src/pages/workouts/components/WorkoutItem.vue @@ -380,7 +380,7 @@
@@ -401,9 +401,9 @@ - {{ lightboxIndex + 1 }} / {{ photos.length }} + {{ lightboxIndex + 1 }} / {{ lightboxSet.length }}
@@ -1206,9 +1206,11 @@ const photosWithCoords = computed(() => ); const showLightbox = ref(false); const lightboxIndex = ref(0); +const lightboxSet = ref>([]); const openPhoto = (photo: WorkoutPhoto) => { const idx = photos.value.findIndex((p) => p.id === photo.id); if (idx >= 0) { + lightboxSet.value = photos.value; lightboxIndex.value = idx; showLightbox.value = true; } @@ -1237,15 +1239,16 @@ function isSamePointCluster(c: ClustererInfo): boolean { function openClusterPhotos(c: ClustererInfo) { if (!c.features || c.features.length === 0) return; const [lng, lat] = c.lnglat as [number, number]; - const idx = photos.value.findIndex( + const set = photos.value.filter( (p) => p.latitude !== null && p.longitude !== null && Math.abs(p.longitude - lng) < CLUSTER_SAME_POINT_EPS && Math.abs(p.latitude - lat) < CLUSTER_SAME_POINT_EPS, ); - if (idx >= 0) { - lightboxIndex.value = idx; + if (set.length > 0) { + lightboxSet.value = set; + lightboxIndex.value = 0; showLightbox.value = true; } } @@ -1286,11 +1289,14 @@ function focusPhotoOnMap(photo: WorkoutPhoto) { }); } const prevPhoto = () => { - lightboxIndex.value = - (lightboxIndex.value - 1 + photos.value.length) % photos.value.length; + const len = lightboxSet.value.length; + if (len === 0) return; + lightboxIndex.value = (lightboxIndex.value - 1 + len) % len; }; const nextPhoto = () => { - lightboxIndex.value = (lightboxIndex.value + 1) % photos.value.length; + const len = lightboxSet.value.length; + if (len === 0) return; + lightboxIndex.value = (lightboxIndex.value + 1) % len; }; const onLightboxKeydown = (event: KeyboardEvent) => { if (!showLightbox.value) {