Skip to content

Commit

Permalink
Merge pull request #1278 from Kalabint/bugfix/fix-color-normalization
Browse files Browse the repository at this point in the history
Changed function call after color normalization fix, and unified var …
  • Loading branch information
tananaev authored Oct 8, 2024
2 parents 524a28f + 11fc783 commit 6b443a5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/map/MapRoutePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -74,6 +75,7 @@ const MapRoutePath = ({ positions }) => {
properties: {
color: reportColor || getSpeedColor(
positions[i + 1].speed,
minSpeed,
maxSpeed,
),
},
Expand Down

0 comments on commit 6b443a5

Please sign in to comment.