Skip to content

Commit a92793d

Browse files
committed
Cluster styling: Cap large cluster size
1 parent 25c8309 commit a92793d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/components/map/RadiusUtil.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
export const populationToRadius = population => {
22
const baseRadius = 20; // This radius is for a population of 1
3+
const MIN_RADIUS = 14;
4+
const MAX_RADIUS = 90;
35

46
/**
57
* Use base population area to find proportional
68
* area and radius for new population
79
*/
810
const popMultiplier = Math.sqrt(population) * baseRadius;
11+
912
/**
1013
* Scale value so that min and max values are bounded.
1114
* Max cluster population is around ~950 with a max radius of ~150
1215
*/
13-
return Math.floor(popMultiplier / 5 + 14);
16+
const scaledValue = Math.floor(popMultiplier / 5 + 10);
17+
return Math.min(MAX_RADIUS, Math.max(MIN_RADIUS, scaledValue));
1418
};
1519

1620
export const populationToSize = population => {

src/css/map.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@
4141
.circle-cluster-md div,
4242
.circle-icon-lg div,
4343
.circle-cluster-lg div {
44-
font-size: 14px;
44+
font-size: 12px;
4545
}
4646

4747
.circle-icon-xl div,
4848
.circle-cluster-xl div,
4949
.circle-icon-xxl div,
5050
.circle-cluster-xxl div {
51-
font-size: 18px;
51+
font-size: 14px;
5252
}
5353

5454
#map-spinner-container {

0 commit comments

Comments
 (0)