Fix map clusters: use Apollo client, remove flyTo on hover
All checks were successful
Build Docker Image / build (push) Successful in 4m48s
All checks were successful
Build Docker Image / build (push) Successful in 4m48s
This commit is contained in:
@@ -272,21 +272,6 @@ watch(() => props.selectedId, (uuid) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// Watch hoveredId and fly to it
|
|
||||||
watch(() => props.hoveredId, (uuid) => {
|
|
||||||
if (uuid && props.withMap) {
|
|
||||||
// Try direct match first
|
|
||||||
let item = itemsWithCoords.value.find(i => i.uuid === uuid)
|
|
||||||
// If not found, try matching by orderUuid (for mapItems with separate source/dest points)
|
|
||||||
if (!item) {
|
|
||||||
item = itemsWithCoords.value.find(i => i.uuid === `${uuid}-source` || (i as any).orderUuid === uuid)
|
|
||||||
}
|
|
||||||
if (item) {
|
|
||||||
mapRef.value?.flyTo(item.latitude, item.longitude, 8)
|
|
||||||
mobileMapRef.value?.flyTo(item.latitude, item.longitude, 8)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Expose flyTo for external use
|
// Expose flyTo for external use
|
||||||
const flyTo = (lat: number, lng: number, zoom = 8) => {
|
const flyTo = (lat: number, lng: number, zoom = 8) => {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export interface MapBounds {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function useClusteredNodes(transportType?: Ref<string | undefined>) {
|
export function useClusteredNodes(transportType?: Ref<string | undefined>) {
|
||||||
const { $geoClient } = useNuxtApp()
|
const { client } = useApolloClient('publicGeo')
|
||||||
|
|
||||||
const clusteredNodes = ref<ClusterPointType[]>([])
|
const clusteredNodes = ref<ClusterPointType[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
@@ -18,7 +18,7 @@ export function useClusteredNodes(transportType?: Ref<string | undefined>) {
|
|||||||
const fetchClusters = async (bounds: MapBounds) => {
|
const fetchClusters = async (bounds: MapBounds) => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const { data } = await $geoClient.query({
|
const { data } = await client.query({
|
||||||
query: GetClusteredNodesDocument,
|
query: GetClusteredNodesDocument,
|
||||||
variables: {
|
variables: {
|
||||||
west: bounds.west,
|
west: bounds.west,
|
||||||
|
|||||||
Reference in New Issue
Block a user