Merge pull request #1278 from Kalabint/bugfix/fix-color-normalization

Changed function call after color normalization fix, and unified var …
This commit is contained in:
Anton Tananaev 2024-10-08 14:40:29 -07:00 committed by GitHub
commit 6b443a596f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,7 +62,8 @@ const MapRoutePath = ({ positions }) => {
}, []);
useEffect(() => {
const maxSpeed = positions.map((item) => item.speed).reduce((a, b) => Math.max(a, b), -Infinity);
const minSpeed = positions.map((p) => p.speed).reduce((a, b) => Math.min(a, b), Infinity);
const maxSpeed = positions.map((p) => p.speed).reduce((a, b) => Math.max(a, b), -Infinity);
const features = [];
for (let i = 0; i < positions.length - 1; i += 1) {
features.push({
@ -74,6 +75,7 @@ const MapRoutePath = ({ positions }) => {
properties: {
color: reportColor || getSpeedColor(
positions[i + 1].speed,
minSpeed,
maxSpeed,
),
},