Modified cluster styling to have gradients

This commit is contained in:
efarooqui
2020-10-14 21:05:58 -07:00
parent b5bb7472ac
commit 32da7f0105
3 changed files with 28 additions and 4 deletions

View File

@@ -16,6 +16,7 @@ import Clusters from './presentational/Map/Clusters.jsx'
import SelectedEvents from './presentational/Map/SelectedEvents.jsx'
import Narratives from './presentational/Map/Narratives'
import DefsMarkers from './presentational/Map/DefsMarkers.jsx'
import DefsClusters from './presentational/Map/DefsClusters.jsx'
import { mapClustersToLocations } from '../common/utilities'
@@ -328,6 +329,14 @@ class Map extends React.Component {
)
}
renderClusterGradients () {
return (
<Portal node={this.svgRef.current}>
<DefsClusters />
</Portal>
)
}
renderMarkers () {
return (
<Portal node={this.svgRef.current}>
@@ -343,6 +352,7 @@ class Map extends React.Component {
<React.Fragment>
{this.renderTiles()}
{this.renderMarkers()}
{this.renderClusterGradients()}
{isShowingSites ? this.renderSites() : null}
{this.renderShapes()}
{this.renderNarratives()}

View File

@@ -27,10 +27,10 @@ function ClusterEvents ({
const totalPoints = calculateTotalPoints()
const styles = ({
fill: colors.fallbackEventColor,
stroke: colors.darkBackground,
strokeWidth: 0,
fillOpacity: calcClusterOpacity(pointCount, totalPoints)
// fill: colors.fallbackEventColor,
// stroke: colors.darkBackground,
// strokeWidth: 0,
fillOpacity: calcClusterOpacity(pointCount, totalPoints),
})
return (
@@ -44,6 +44,7 @@ function ClusterEvents ({
cy='0'
r={calcClusterSize(pointCount, totalPoints)}
style={styles}
fill="url('#myGradient')"
/>}
</React.Fragment>
)

View File

@@ -0,0 +1,13 @@
import React from 'react'
const DefsClusters = () => (
<defs>
<radialGradient id="myGradient">
<stop offset="10%" stop-color="red" />
<stop offset="95%" stop-color="black" />
{/* <stop offset="95%" stop-color="red" /> */}
</radialGradient>
</defs>
)
export default DefsClusters