diff --git a/src/common/utilities.js b/src/common/utilities.js index 898ee56..2fb70f9 100644 --- a/src/common/utilities.js +++ b/src/common/utilities.js @@ -173,7 +173,7 @@ export function calcClusterOpacity (pointCount, totalPoints) { } export function calcClusterSize (pointCount, totalPoints) { - return Math.min(50, 10 + (pointCount / totalPoints) * 250) + return Math.min(50, 10 + (pointCount / totalPoints) * 150) } export function isLatitude (lat) { diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 9c78ca5..89e2c91 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -313,6 +313,7 @@ class Map extends React.Component { styleCluster={this.styleCluster} projectPoint={this.projectPoint} clusters={allClusters} + isRadial={this.props.ui.radial} onSelect={this.onClusterSelect} /> ) @@ -352,7 +353,7 @@ class Map extends React.Component { {this.renderTiles()} {this.renderMarkers()} - {this.renderClusterGradients()} + {this.props.ui.radial ? this.renderClusterGradients(): null} {isShowingSites ? this.renderSites() : null} {this.renderShapes()} {this.renderNarratives()} @@ -399,7 +400,8 @@ function mapStateToProps (state) { narratives: state.ui.style.narratives, mapSelectedEvents: state.ui.style.selectedEvents, shapes: state.ui.style.shapes, - eventRadius: state.ui.eventRadius + eventRadius: state.ui.eventRadius, + radial: state.ui.style.clusters.radial }, features: selectors.getFeatures(state) } diff --git a/src/components/presentational/Map/Clusters.jsx b/src/components/presentational/Map/Clusters.jsx index 6da97ef..cbd8cc4 100644 --- a/src/components/presentational/Map/Clusters.jsx +++ b/src/components/presentational/Map/Clusters.jsx @@ -7,6 +7,7 @@ function ClusterEvents ({ projectPoint, styleCluster, onSelect, + isRadial, svg, clusters }) { @@ -27,7 +28,7 @@ function ClusterEvents ({ const totalPoints = calculateTotalPoints() const styles = ({ - fill: colors.fallbackEventColor, + fill: isRadial ? "url('#clusterGradient')" : colors.fallbackEventColor, stroke: colors.darkBackground, strokeWidth: 0, fillOpacity: calcClusterOpacity(pointCount, totalPoints), @@ -44,7 +45,6 @@ function ClusterEvents ({ cy='0' r={calcClusterSize(pointCount, totalPoints)} style={styles} - // fill="url('#clusterGradient')" />} ) diff --git a/src/components/presentational/Map/DefsClusters.jsx b/src/components/presentational/Map/DefsClusters.jsx index 91ed1ac..577ab42 100644 --- a/src/components/presentational/Map/DefsClusters.jsx +++ b/src/components/presentational/Map/DefsClusters.jsx @@ -4,7 +4,7 @@ const DefsClusters = () => ( - + ) diff --git a/src/store/initial.js b/src/store/initial.js index 8c2cfd6..eeeed43 100644 --- a/src/store/initial.js +++ b/src/store/initial.js @@ -121,6 +121,9 @@ const initial = { strokeWidth: 3, opacity: 0.9 } + }, + clusters: { + radial: false } }, dom: {