diff options
author | Anton Tananaev <anton@traccar.org> | 2022-12-19 17:28:20 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-12-19 17:28:20 -0800 |
commit | a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d (patch) | |
tree | 3b88dae75b0d7f26fc8fff2a7fe8dfae7ce0f7ab /modern/src/map | |
parent | 877108d9012301f2b149ae862af4cffe17dfb20d (diff) | |
download | trackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.tar.gz trackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.tar.bz2 trackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.zip |
Configurable device direction
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/MapPositions.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/modern/src/map/MapPositions.js b/modern/src/map/MapPositions.js index 2f038ec6..ba510209 100644 --- a/modern/src/map/MapPositions.js +++ b/modern/src/map/MapPositions.js @@ -16,9 +16,22 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF const iconScale = useAttributePreference('iconScale', 1); const mapCluster = useAttributePreference('mapCluster', true); const hours12 = usePreference('twelveHourFormat'); + const directionType = useAttributePreference('mapDirection', 'selected'); const createFeature = (devices, position, selectedPositionId) => { const device = devices[position.deviceId]; + let showDirection; + switch (directionType) { + case 'none': + showDirection = false; + break; + case 'all': + showDirection = true; + break; + default: + showDirection = selectedPositionId === position.id; + break; + } return { id: position.id, deviceId: position.deviceId, @@ -27,7 +40,7 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF category: mapIconKey(device.category), color: showStatus ? position.attributes.color || getStatusColor(device.status) : 'neutral', rotation: position.course, - direction: selectedPositionId === position.id, + direction: showDirection, }; }; |