diff --git a/CHANGELOG.md b/CHANGELOG.md index e06065c..f63f5af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [1.0.5] - 2023-08-27 +## [1.0.6] - 2023-08-27 ### Changed diff --git a/package-lock.json b/package-lock.json index 276b368..223401c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "dash-leaflet", - "version": "1.0.5", + "version": "1.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dash-leaflet", - "version": "1.0.5", + "version": "1.0.6", "license": "MIT", "dependencies": { "base64-js": "^1.5.1", diff --git a/package.json b/package.json index 74b9065..ec9dcbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dash-leaflet", - "version": "1.0.5", + "version": "1.0.6", "description": "Dash Leaflet is a light wrapper around React-Leaflet. The syntax is similar to other Dash components, with naming conventions following the React-Leaflet API.", "main": "index.ts", "repository": { diff --git a/src/ts/react-leaflet/GeoJSON.ts b/src/ts/react-leaflet/GeoJSON.ts index 23d4277..e98186e 100644 --- a/src/ts/react-leaflet/GeoJSON.ts +++ b/src/ts/react-leaflet/GeoJSON.ts @@ -237,11 +237,7 @@ function _redrawClusters(instance, props, map, index, toSpiderfyRef) { } catch (err) { return } - // Reduce clusters to delta, i.e. the ones that need to be added. - if(Object.keys(instance._layers).length > 0){ - clusters = deltaClusters(instance, clusters) - } - // Update the data. + // Update with spiderfied data. if (props.spiderfyOnMaxZoom && toSpiderfyRef.current) { // If zoom level has changes, drop the spiderfy state. if (toSpiderfyRef.current.zoom && toSpiderfyRef.current.zoom !== zoom) { @@ -253,6 +249,10 @@ function _redrawClusters(instance, props, map, index, toSpiderfyRef) { toSpiderfyRef.current.zoom = zoom; } } + // Reduce clusters to delta, i.e. the ones that need to be added. + if(Object.keys(instance._layers).length > 0){ + clusters = deltaClusters(instance, clusters) + } // If the data hasn't changed, just return. if(clusters.length === 0){return;} // Add clusters to the map. @@ -423,7 +423,11 @@ function _defaultSpiderfy(map, index, clusters, toSpiderfy) { for (let i = 0; i < leaves.length; i++) { newPos = map.layerPointToLatLng(positions[i]); leg = [cluster.geometry.coordinates, [newPos.lng, newPos.lat]]; - legs.push({"type": "Feature", "geometry": {"type": "LineString", "coordinates": leg}}); + legs.push({ + "type": "Feature", + "geometry": {"type": "LineString", "coordinates": leg}, + "properties": {"id": leaves[i].properties.id} + }); // Update the marker position. leaves[i] = update(leaves[i], {geometry: {coordinates: {$set: [newPos.lng, newPos.lat]}}}) }