diff options
author | Anton Tananaev <anton@traccar.org> | 2024-04-07 14:10:58 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2024-04-07 14:10:58 -0700 |
commit | 6b0dfe921078d72e661bad8f14ecde224f5c2e8a (patch) | |
tree | 36dce301e73c79fcac2d096d3585cd915cc7b836 | |
parent | 21b3a9775d7eb73b648bb92cba05e5f2c9c088fc (diff) | |
download | trackermap-web-6b0dfe921078d72e661bad8f14ecde224f5c2e8a.tar.gz trackermap-web-6b0dfe921078d72e661bad8f14ecde224f5c2e8a.tar.bz2 trackermap-web-6b0dfe921078d72e661bad8f14ecde224f5c2e8a.zip |
Use default map font
-rw-r--r-- | src/map/MapGeofence.js | 3 | ||||
-rw-r--r-- | src/map/MapMarkers.js | 2 | ||||
-rw-r--r-- | src/map/MapPositions.js | 3 | ||||
-rw-r--r-- | src/map/MapRoutePath.js | 2 | ||||
-rw-r--r-- | src/map/core/mapUtil.js | 18 | ||||
-rw-r--r-- | src/map/main/PoiMap.js | 2 |
6 files changed, 1 insertions, 29 deletions
diff --git a/src/map/MapGeofence.js b/src/map/MapGeofence.js index 73b32724..ac83d5b4 100644 --- a/src/map/MapGeofence.js +++ b/src/map/MapGeofence.js @@ -2,7 +2,7 @@ import { useId, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { useTheme } from '@mui/styles'; import { map } from './core/MapView'; -import { findFonts, geofenceToFeature } from './core/mapUtil'; +import { geofenceToFeature } from './core/mapUtil'; import { useAttributePreference } from '../common/util/preferences'; const MapGeofence = () => { @@ -52,7 +52,6 @@ const MapGeofence = () => { type: 'symbol', layout: { 'text-field': '{name}', - 'text-font': findFonts(map), 'text-size': 12, }, paint: { diff --git a/src/map/MapMarkers.js b/src/map/MapMarkers.js index 8fbe92b6..484c35a3 100644 --- a/src/map/MapMarkers.js +++ b/src/map/MapMarkers.js @@ -3,7 +3,6 @@ import { useTheme } from '@mui/styles'; import { useMediaQuery } from '@mui/material'; import { map } from './core/MapView'; import { useAttributePreference } from '../common/util/preferences'; -import { findFonts } from './core/mapUtil'; const MapMarkers = ({ markers, showTitles }) => { const id = useId(); @@ -35,7 +34,6 @@ const MapMarkers = ({ markers, showTitles }) => { 'text-allow-overlap': true, 'text-anchor': 'bottom', 'text-offset': [0, -2 * iconScale], - 'text-font': findFonts(map), 'text-size': 12, }, paint: { diff --git a/src/map/MapPositions.js b/src/map/MapPositions.js index 751c61b9..c79a0c58 100644 --- a/src/map/MapPositions.js +++ b/src/map/MapPositions.js @@ -5,7 +5,6 @@ import { useTheme } from '@mui/styles'; import { map } from './core/MapView'; import { formatTime, getStatusColor } from '../common/util/formatter'; import { mapIconKey } from './core/preloadImages'; -import { findFonts } from './core/mapUtil'; import { useAttributePreference, usePreference } from '../common/util/preferences'; const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleField }) => { @@ -115,7 +114,6 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF 'text-allow-overlap': true, 'text-anchor': 'bottom', 'text-offset': [0, -2 * iconScale], - 'text-font': findFonts(map), 'text-size': 12, }, paint: { @@ -154,7 +152,6 @@ const MapPositions = ({ positions, onClick, showStatus, selectedPosition, titleF 'icon-image': 'background', 'icon-size': iconScale, 'text-field': '{point_count_abbreviated}', - 'text-font': findFonts(map), 'text-size': 14, }, }); diff --git a/src/map/MapRoutePath.js b/src/map/MapRoutePath.js index 18069a71..20269140 100644 --- a/src/map/MapRoutePath.js +++ b/src/map/MapRoutePath.js @@ -2,7 +2,6 @@ import { useTheme } from '@mui/styles'; import { useId, useEffect } from 'react'; import { useSelector } from 'react-redux'; import { map } from './core/MapView'; -import { findFonts } from './core/mapUtil'; const MapRoutePath = ({ name, positions, coordinates }) => { const id = useId(); @@ -54,7 +53,6 @@ const MapRoutePath = ({ name, positions, coordinates }) => { type: 'symbol', layout: { 'text-field': '{name}', - 'text-font': findFonts(map), 'text-size': 12, }, paint: { diff --git a/src/map/core/mapUtil.js b/src/map/core/mapUtil.js index 8dcded2c..4870dd0d 100644 --- a/src/map/core/mapUtil.js +++ b/src/map/core/mapUtil.js @@ -85,21 +85,3 @@ export const geofenceToFeature = (theme, item) => { }; export const geometryToArea = (geometry) => stringify(reverseCoordinates(geometry)); - -export const findFonts = (map) => { - const fontSet = new Set(); - const { layers } = map.getStyle(); - layers?.forEach?.((layer) => { - layer.layout?.['text-font']?.forEach?.(fontSet.add, fontSet); - }); - const availableFonts = [...fontSet]; - const regularFont = availableFonts.find((it) => it.includes('Regular')); - if (regularFont) { - return [regularFont]; - } - const anyFont = availableFonts.find(Boolean); - if (anyFont) { - return [anyFont]; - } - return ['Roboto Regular']; -}; diff --git a/src/map/main/PoiMap.js b/src/map/main/PoiMap.js index 07341183..e8aefd7e 100644 --- a/src/map/main/PoiMap.js +++ b/src/map/main/PoiMap.js @@ -4,7 +4,6 @@ import { useTheme } from '@mui/styles'; import { map } from '../core/MapView'; import { useEffectAsync } from '../../reactHelper'; import { usePreference } from '../../common/util/preferences'; -import { findFonts } from '../core/mapUtil'; const PoiMap = () => { const id = useId(); @@ -55,7 +54,6 @@ const PoiMap = () => { 'text-field': '{name}', 'text-anchor': 'bottom', 'text-offset': [0, -0.5], - 'text-font': findFonts(map), 'text-size': 12, }, paint: { |