Modified clusters to take in radial gradient as input if specified

This commit is contained in:
efarooqui
2020-10-15 09:23:19 -07:00
parent 2aaa1752ad
commit 3bf80bce00
5 changed files with 11 additions and 6 deletions

View File

@@ -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 {
<React.Fragment>
{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)
}

View File

@@ -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')"
/>}
</React.Fragment>
)

View File

@@ -4,7 +4,7 @@ const DefsClusters = () => (
<defs>
<radialGradient id="clusterGradient">
<stop offset="10%" stop-color="red"/>
<stop offset="100%" stop-color="black"/>
<stop offset="90%" stop-color="transparent"/>
</radialGradient>
</defs>
)