пропадали кружки при клике
Gitea Actions Demo / build_and_push (push) Successful in 1m14s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m14s
Details
This commit is contained in:
parent
794b74cadb
commit
1e9939aa6d
|
|
@ -75,13 +75,7 @@
|
||||||
<yandex-map-marker
|
<yandex-map-marker
|
||||||
v-for="photo in photosWithCoords"
|
v-for="photo in photosWithCoords"
|
||||||
:key="'photo-' + photo.id"
|
:key="'photo-' + photo.id"
|
||||||
:settings="{
|
:settings="getPhotoMarkerSettings(photo)"
|
||||||
coordinates: [
|
|
||||||
photo.longitude as number,
|
|
||||||
photo.latitude as number,
|
|
||||||
] as LngLat,
|
|
||||||
onClick: (_: unknown, __: unknown) => openPhoto(photo),
|
|
||||||
}"
|
|
||||||
position="top-center left-center"
|
position="top-center left-center"
|
||||||
>
|
>
|
||||||
<div class="photo-single">1</div>
|
<div class="photo-single">1</div>
|
||||||
|
|
@ -1229,6 +1223,34 @@ const openPhoto = (photo: WorkoutPhoto) => {
|
||||||
showLightbox.value = true;
|
showLightbox.value = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const photoMarkerSettings = new Map<
|
||||||
|
string,
|
||||||
|
{ coordinates: LngLat; onClick: (e: unknown, event: unknown) => void }
|
||||||
|
>();
|
||||||
|
/**
|
||||||
|
* Stable per-photo marker settings objects. A fresh inline :settings on every
|
||||||
|
* parent re-render would patch the YandexMapMarker component, whose onUpdated()
|
||||||
|
* removes the marker DOM node (it is owned by the clusterer and is not inside
|
||||||
|
* <ymaps> at that moment); the clusterer then reuses the same entity without
|
||||||
|
* recreating the element, so the single marker would disappear forever.
|
||||||
|
*/
|
||||||
|
function getPhotoMarkerSettings(photo: WorkoutPhoto): {
|
||||||
|
coordinates: LngLat;
|
||||||
|
onClick: (e: unknown, event: unknown) => void;
|
||||||
|
} {
|
||||||
|
let s = photoMarkerSettings.get(photo.id);
|
||||||
|
if (!s) {
|
||||||
|
s = {
|
||||||
|
coordinates: [
|
||||||
|
photo.longitude as number,
|
||||||
|
photo.latitude as number,
|
||||||
|
] as LngLat,
|
||||||
|
onClick: (_: unknown, __: unknown) => openPhoto(photo),
|
||||||
|
};
|
||||||
|
photoMarkerSettings.set(photo.id, s);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
type ClusterFeature = {
|
type ClusterFeature = {
|
||||||
geometry: { coordinates: [number, number, ...number[]] };
|
geometry: { coordinates: [number, number, ...number[]] };
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue