aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapPositions.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-10-24 21:50:03 -0700
committerAnton Tananaev <anton@traccar.org>2022-10-24 21:50:03 -0700
commitc000fa00d3a4b71a814864b9c805885f85bdd8dc (patch)
treec32c23d4d11bb8f89d9ac5b9f8598cf43918a1ec /modern/src/map/MapPositions.js
parentd307f8f7e0556c0a7f4544618a081eb9a80c5845 (diff)
downloadtrackermap-web-c000fa00d3a4b71a814864b9c805885f85bdd8dc.tar.gz
trackermap-web-c000fa00d3a4b71a814864b9c805885f85bdd8dc.tar.bz2
trackermap-web-c000fa00d3a4b71a814864b9c805885f85bdd8dc.zip
Improve map markers
Diffstat (limited to 'modern/src/map/MapPositions.js')
-rw-r--r--modern/src/map/MapPositions.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js
index 704c24bd..e4365fab 100644
--- a/modern/src/map/MapPositions.js
+++ b/modern/src/map/MapPositions.js
@@ -1,13 +1,13 @@
import { useId, useCallback, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { map } from './core/MapView';
-import { getStatusColor } from '../common/util/formatter';
+import { formatTime, getStatusColor } from '../common/util/formatter';
import usePersistedState from '../common/util/usePersistedState';
import { mapIconKey } from './core/preloadImages';
import { findFonts } from './core/mapUtil';
import { useAttributePreference } from '../common/util/preferences';
-const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => {
+const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleField }) => {
const id = useId();
const clusters = `${id}-clusters`;
const direction = `${id}-direction`;
@@ -24,6 +24,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => {
id: position.id,
deviceId: position.deviceId,
name: device.name,
+ fixTime: formatTime(position.fixTime),
category: mapIconKey(device.category),
color: showStatus ? position.attributes.color || getStatusColor(device.status) : 'neutral',
rotation: position.course,
@@ -84,7 +85,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition }) => {
'icon-image': '{category}-{color}',
'icon-size': iconScale,
'icon-allow-overlap': true,
- 'text-field': '{name}',
+ 'text-field': `{${titleField || 'name'}}`,
'text-allow-overlap': true,
'text-anchor': 'bottom',
'text-offset': [0, -2 * iconScale],