mirror of
https://github.com/traccar/traccar-web.git
synced 2025-01-08 12:07:27 +08:00
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:
commit
6b443a596f
@ -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,
|
||||
),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user