поправил фотографии
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>
|
</VaForm>
|
||||||
</VaModal>
|
</VaModal>
|
||||||
<div
|
<div
|
||||||
v-if="showLightbox && photos.length > 0"
|
v-if="showLightbox && lightboxSet.length > 0"
|
||||||
class="photo-lightbox"
|
class="photo-lightbox"
|
||||||
@click.self="showLightbox = false"
|
@click.self="showLightbox = false"
|
||||||
>
|
>
|
||||||
|
|
@ -401,9 +401,9 @@
|
||||||
<VaIcon name="chevron_left" size="large" />
|
<VaIcon name="chevron_left" size="large" />
|
||||||
</button>
|
</button>
|
||||||
<img
|
<img
|
||||||
:src="photos[lightboxIndex].url"
|
:src="lightboxSet[lightboxIndex].url"
|
||||||
class="lightbox-img"
|
class="lightbox-img"
|
||||||
:alt="photos[lightboxIndex].id"
|
:alt="lightboxSet[lightboxIndex].id"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="lightbox-nav lightbox-next"
|
class="lightbox-nav lightbox-next"
|
||||||
|
|
@ -414,7 +414,7 @@
|
||||||
<VaIcon name="chevron_right" size="large" />
|
<VaIcon name="chevron_right" size="large" />
|
||||||
</button>
|
</button>
|
||||||
<span class="lightbox-counter">
|
<span class="lightbox-counter">
|
||||||
{{ lightboxIndex + 1 }} / {{ photos.length }}
|
{{ lightboxIndex + 1 }} / {{ lightboxSet.length }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -1206,9 +1206,11 @@ const photosWithCoords = computed(() =>
|
||||||
);
|
);
|
||||||
const showLightbox = ref(false);
|
const showLightbox = ref(false);
|
||||||
const lightboxIndex = ref(0);
|
const lightboxIndex = ref(0);
|
||||||
|
const lightboxSet = ref<Array<WorkoutPhoto>>([]);
|
||||||
const openPhoto = (photo: WorkoutPhoto) => {
|
const openPhoto = (photo: WorkoutPhoto) => {
|
||||||
const idx = photos.value.findIndex((p) => p.id === photo.id);
|
const idx = photos.value.findIndex((p) => p.id === photo.id);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
|
lightboxSet.value = photos.value;
|
||||||
lightboxIndex.value = idx;
|
lightboxIndex.value = idx;
|
||||||
showLightbox.value = true;
|
showLightbox.value = true;
|
||||||
}
|
}
|
||||||
|
|
@ -1237,15 +1239,16 @@ function isSamePointCluster(c: ClustererInfo): boolean {
|
||||||
function openClusterPhotos(c: ClustererInfo) {
|
function openClusterPhotos(c: ClustererInfo) {
|
||||||
if (!c.features || c.features.length === 0) return;
|
if (!c.features || c.features.length === 0) return;
|
||||||
const [lng, lat] = c.lnglat as [number, number];
|
const [lng, lat] = c.lnglat as [number, number];
|
||||||
const idx = photos.value.findIndex(
|
const set = photos.value.filter(
|
||||||
(p) =>
|
(p) =>
|
||||||
p.latitude !== null &&
|
p.latitude !== null &&
|
||||||
p.longitude !== null &&
|
p.longitude !== null &&
|
||||||
Math.abs(p.longitude - lng) < CLUSTER_SAME_POINT_EPS &&
|
Math.abs(p.longitude - lng) < CLUSTER_SAME_POINT_EPS &&
|
||||||
Math.abs(p.latitude - lat) < CLUSTER_SAME_POINT_EPS,
|
Math.abs(p.latitude - lat) < CLUSTER_SAME_POINT_EPS,
|
||||||
);
|
);
|
||||||
if (idx >= 0) {
|
if (set.length > 0) {
|
||||||
lightboxIndex.value = idx;
|
lightboxSet.value = set;
|
||||||
|
lightboxIndex.value = 0;
|
||||||
showLightbox.value = true;
|
showLightbox.value = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1286,11 +1289,14 @@ function focusPhotoOnMap(photo: WorkoutPhoto) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const prevPhoto = () => {
|
const prevPhoto = () => {
|
||||||
lightboxIndex.value =
|
const len = lightboxSet.value.length;
|
||||||
(lightboxIndex.value - 1 + photos.value.length) % photos.value.length;
|
if (len === 0) return;
|
||||||
|
lightboxIndex.value = (lightboxIndex.value - 1 + len) % len;
|
||||||
};
|
};
|
||||||
const nextPhoto = () => {
|
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) => {
|
const onLightboxKeydown = (event: KeyboardEvent) => {
|
||||||
if (!showLightbox.value) {
|
if (!showLightbox.value) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue