From d7ddc80c5c123647fe4df650f1b0f95a9a09594c Mon Sep 17 00:00:00 2001 From: efarooqui Date: Wed, 21 Oct 2020 20:52:59 -0700 Subject: [PATCH] Moved supercluster config outside of map; to set the lowest level at which clusters appear, set maxZoom in config --- src/components/Map.jsx | 9 +++++---- src/store/initial.js | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 35545d3..0245f7f 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -79,7 +79,7 @@ class Map extends React.Component { /** * Creates a Leaflet map and a tilelayer for the map background */ - const { map: mapConfig } = this.props.app + const { map: mapConfig, cluster: clusterConfig } = this.props.app const map = L.map(this.props.ui.dom.map) @@ -90,9 +90,9 @@ class Map extends React.Component { // Initialize supercluster index this.superclusterIndex = new Supercluster({ - radius: mapConfig.clusterRadius, - maxZoom: mapConfig.maxZoom, - minZoom: mapConfig.minZoom + radius: clusterConfig.radius, + maxZoom: clusterConfig.maxZoom, + minZoom: clusterConfig.minZoom }) let firstLayer @@ -385,6 +385,7 @@ function mapStateToProps (state) { selected: selectors.selectSelected(state), highlighted: state.app.highlighted, map: state.app.map, + cluster: state.app.cluster, language: state.app.language, loading: state.app.loading, narrative: state.app.associations.narrative, diff --git a/src/store/initial.js b/src/store/initial.js index eeeed43..3fb2a21 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -52,7 +52,11 @@ const initial = { maxZoom: 16, bounds: null, maxBounds: [[180, -180], [-180, 180]], - clusterRadius: 30 + }, + cluster: { + radius: 30, + minZoom: 2, + maxZoom: 16 }, timeline: { dimensions: {