Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
emilhe committed Aug 27, 2023
1 parent 61010ce commit 74c7ee8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
16 changes: 10 additions & 6 deletions src/ts/react-leaflet/GeoJSON.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.
Expand Down Expand Up @@ -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]}}})
}
Expand Down

0 comments on commit 74c7ee8

Please sign in to comment.