From c000fa00d3a4b71a814864b9c805885f85bdd8dc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 24 Oct 2022 21:50:03 -0700 Subject: Improve map markers --- modern/src/map/MapPositions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'modern/src/map/MapPositions.js') 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], -- cgit v1.2.3