File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,14 @@ const locations = [
76
76
const onMapReady = async () => {
77
77
const { markers, markerCluster } = await useLMarkerCluster ({
78
78
leafletObject: map .value .leafletObject ,
79
- markers: locations
79
+ markers: locations ,
80
+ options: {
81
+ // showCoverageOnHover: true
82
+ // zoomToBoundsOnClick: true
83
+ // spiderfyOnMaxZoom: true
84
+ // removeOutsideVisibleBounds: true
85
+ // spiderLegPolylineOptions: { weight: 1.5, color: '#222', opacity: 0.5 }
86
+ }
80
87
});
81
88
// Access the markers
82
89
markers [3 ].bindPopup (' <h1>Hello Pornic</h1><button type="button" style="background: black; color: white;">Click me</button>' );
Original file line number Diff line number Diff line change @@ -11,9 +11,18 @@ interface MarkerProps {
11
11
popup ?: string
12
12
}
13
13
14
+ interface MarkerClusterGroupOptions {
15
+ showCoverageOnHover ?: boolean
16
+ zoomToBoundsOnClick ?: boolean
17
+ spiderfyOnMaxZoom ?: boolean
18
+ removeOutsideVisibleBounds ?: boolean
19
+ spiderLegPolylineOptions ?: any
20
+ }
21
+
14
22
interface Props {
15
23
leafletObject : Map
16
24
markers : MarkerProps [ ]
25
+ options ?: MarkerClusterGroupOptions
17
26
}
18
27
19
28
export const useLMarkerCluster = async ( props : Props ) => {
@@ -25,7 +34,7 @@ export const useLMarkerCluster = async (props: Props) => {
25
34
const { MarkerClusterGroup } = await import ( 'leaflet.markercluster' )
26
35
27
36
// Initialize marker cluster
28
- const markerCluster = new MarkerClusterGroup ( )
37
+ const markerCluster = new MarkerClusterGroup ( props . options )
29
38
30
39
// Create an array to store the markers
31
40
const markers = [ ] as Marker [ ]
You can’t perform that action at this time.
0 commit comments