Skip to content

Commit

Permalink
Merge pull request #1799 from ushahidi/fix/use-map-clustering
Browse files Browse the repository at this point in the history
fix(map): observe cluster_radius map configuration from API
  • Loading branch information
tuxpiper authored Jun 28, 2022
2 parents 0ea3615 + 7633c2e commit 94c4278
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion legacy/app/common/services/maps.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ function Maps(ConfigEndpoint, L, _, CONST) {
layers: [L.tileLayer(defaultLayer.url, defaultLayer.layerOptions)],
center: [config.default_view.lat, config.default_view.lon],
zoom: config.default_view.zoom,
clustering: config.clustering
clustering: config.clustering,
cluster_radius: Number(config.cluster_radius || 50)
});
});
}
Expand Down
4 changes: 3 additions & 1 deletion legacy/app/map/post-view-map.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ function PostViewMap(PostEndpoint, Maps, _, PostFilters, L, $q, $rootScope, $com

if (map.options.clustering) {

markers = markers ? markers : L.markerClusterGroup();
markers = markers ? markers : L.markerClusterGroup({
maxClusterRadius: map.options.cluster_radius
});
// This has to be done individually.
// Using clusterLayer.addLayers() breaks the clustering.
// Need to investigate as this should have been fixing in v1.0.0
Expand Down

0 comments on commit 94c4278

Please sign in to comment.