aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapPositions.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-12-19 17:28:20 -0800
committerAnton Tananaev <anton@traccar.org>2022-12-19 17:28:20 -0800
commita5ae8c6cee71e56818bdcc67e5bf929cc07fe01d (patch)
tree3b88dae75b0d7f26fc8fff2a7fe8dfae7ce0f7ab /modern/src/map/MapPositions.js
parent877108d9012301f2b149ae862af4cffe17dfb20d (diff)
downloadtrackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.tar.gz
trackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.tar.bz2
trackermap-web-a5ae8c6cee71e56818bdcc67e5bf929cc07fe01d.zip
Configurable device direction
Diffstat (limited to 'modern/src/map/MapPositions.js')
-rw-r--r--modern/src/map/MapPositions.js15
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,
};
};