map: zoom on preview click
parent
e7c8748cc9
commit
b7dcf4786a
|
@ -13,6 +13,7 @@
|
||||||
v-for="cluster in clusters"
|
v-for="cluster in clusters"
|
||||||
:key="cluster.center.toString()"
|
:key="cluster.center.toString()"
|
||||||
:lat-lng="cluster.center"
|
:lat-lng="cluster.center"
|
||||||
|
@click="zoomTo(cluster.center)"
|
||||||
>
|
>
|
||||||
<LIcon v-if="cluster.id" :icon-anchor="[24, 24]">
|
<LIcon v-if="cluster.id" :icon-anchor="[24, 24]">
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
|
@ -112,6 +113,12 @@ export default defineComponent({
|
||||||
clusterPreviewUrl(cluster: IMarkerCluster) {
|
clusterPreviewUrl(cluster: IMarkerCluster) {
|
||||||
return API.MAP_CLUSTER_PREVIEW(cluster.id);
|
return API.MAP_CLUSTER_PREVIEW(cluster.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
zoomTo(center: [number, number]) {
|
||||||
|
const map = this.$refs.map as LMap;
|
||||||
|
const zoom = Math.max(map.mapObject.getZoom() + 2, 14);
|
||||||
|
map.mapObject.setView(center, zoom, { animate: true });
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -146,6 +153,7 @@ export default defineComponent({
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.count {
|
.count {
|
||||||
|
|
Loading…
Reference in New Issue