Skip to content

Commit

Permalink
Merge pull request #166 from forensic-architecture/bugfix/make-superc…
Browse files Browse the repository at this point in the history
…luster-independently-configurable

Bugfix/make supercluster independently configurable
  • Loading branch information
ebefarooqui authored Oct 22, 2020
2 parents f8e566e + 1c141b6 commit 132d04d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 5 additions & 4 deletions src/components/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions src/store/initial.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ const initial = {
minZoom: 2,
maxZoom: 16,
bounds: null,
maxBounds: [[180, -180], [-180, 180]],
clusterRadius: 30
maxBounds: [[180, -180], [-180, 180]]
},
cluster: {
radius: 30,
minZoom: 2,
maxZoom: 16
},
timeline: {
dimensions: {
Expand Down

0 comments on commit 132d04d

Please sign in to comment.