1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
* Creates an featureEffect centered around a gap between the 2 candidates.
* If the precincts have the specified gap percentage, drop-shadow
* effect is applied to make them stand out from the rest. If they
* fall outside of the specified gap percentage, grayscale, blur
* and opacity effects are applied to subdue their presence.
*/functioncreateEffect(gapValue) {
gapValue = Math.min(100, Math.max(0, gapValue));
functionroundToTheTenth(value) {
returnMath.round(value * 10) / 10;
}
return {
filter: {
where: `PERCENT_GAP > ${roundToTheTenth(gapValue - 1)} AND PERCENT_GAP < ${roundToTheTenth(gapValue + 1)}` },
includedEffect: "drop-shadow(0, 2px, 2px, black)",
excludedEffect: "grayscale(25%) blur(5px) opacity(25%)" }
}