Merged in feat/SW-1750-map-connection (pull request #1439)
Feat(SW-1750): Destination page map connection Approved-by: Erik Tiekstra
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useReducer } from "react"
|
||||
import Supercluster, {type ClusterProperties } from "supercluster"
|
||||
import Supercluster, { type ClusterProperties } from "supercluster"
|
||||
|
||||
import { useMapViewport } from "./use-map-viewport"
|
||||
|
||||
@@ -36,7 +36,16 @@ export function useSupercluster<T extends GeoJsonProperties>(
|
||||
return clusterer.getClusters(bbox, zoom)
|
||||
}, [version, clusterer, bbox, zoom])
|
||||
|
||||
// retrieve the hotel ids included in the cluster
|
||||
const containedHotels = clusters.map((cluster) => {
|
||||
if (cluster.properties?.cluster && typeof cluster.id === "number") {
|
||||
return clusterer.getLeaves(cluster.id).map((hotel) => Number(hotel.id))
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
return {
|
||||
clusters,
|
||||
containedHotels,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user