поправил фотографии
Gitea Actions Demo / build_and_push (push) Successful in 48s
Details
Gitea Actions Demo / build_and_push (push) Successful in 48s
Details
This commit is contained in:
parent
b08870a3ef
commit
2dc35687fa
|
|
@ -380,7 +380,7 @@
|
|||
</VaForm>
|
||||
</VaModal>
|
||||
<div
|
||||
v-if="showLightbox && photos.length > 0"
|
||||
v-if="showLightbox && lightboxSet.length > 0"
|
||||
class="photo-lightbox"
|
||||
@click.self="showLightbox = false"
|
||||
>
|
||||
|
|
@ -401,9 +401,9 @@
|
|||
<VaIcon name="chevron_left" size="large" />
|
||||
</button>
|
||||
<img
|
||||
:src="photos[lightboxIndex].url"
|
||||
:src="lightboxSet[lightboxIndex].url"
|
||||
class="lightbox-img"
|
||||
:alt="photos[lightboxIndex].id"
|
||||
:alt="lightboxSet[lightboxIndex].id"
|
||||
/>
|
||||
<button
|
||||
class="lightbox-nav lightbox-next"
|
||||
|
|
@ -414,7 +414,7 @@
|
|||
<VaIcon name="chevron_right" size="large" />
|
||||
</button>
|
||||
<span class="lightbox-counter">
|
||||
{{ lightboxIndex + 1 }} / {{ photos.length }}
|
||||
{{ lightboxIndex + 1 }} / {{ lightboxSet.length }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1206,9 +1206,11 @@ const photosWithCoords = computed(() =>
|
|||
);
|
||||
const showLightbox = ref(false);
|
||||
const lightboxIndex = ref(0);
|
||||
const lightboxSet = ref<Array<WorkoutPhoto>>([]);
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue