From 11fc783a153e16fb72b047b9258145fb9f31c314 Mon Sep 17 00:00:00 2001 From: Kalabint Date: Tue, 8 Oct 2024 22:21:30 +0200 Subject: [PATCH] Changed function call after color normalization fix, and unified var naming --- src/map/MapRoutePath.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/map/MapRoutePath.js b/src/map/MapRoutePath.js index ae905676ae..7554876671 100644 --- a/src/map/MapRoutePath.js +++ b/src/map/MapRoutePath.js @@ -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, ), },