Skip to content

Commit

Permalink
Changed function call after color normalization fix, and unified var …
Browse files Browse the repository at this point in the history
…naming
  • Loading branch information
Kalabint committed Oct 8, 2024
1 parent 524a28f commit 11fc783
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);

This comment has been minimized.

Copy link
@Kalabint

Kalabint Oct 8, 2024

Author Contributor

Renamed from item -> p to make it more clear, that this does the same as this line here

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 11fc783

Please sign in to comment.