Support RTL languages on map

This commit is contained in:
Anton Tananaev 2024-05-12 13:47:16 -07:00
parent b32a43a277
commit bac808ebfa
3 changed files with 13 additions and 0 deletions

9
package-lock.json generated
View File

@ -13,6 +13,7 @@
"@emotion/styled": "^11.11.5",
"@fontsource/roboto": "^5.0.12",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0",
"@mui/icons-material": "^5.15.15",
"@mui/lab": "^5.0.0-alpha.170",
@ -2450,6 +2451,14 @@
"xtend": "^4.0.2"
}
},
"node_modules/@mapbox/mapbox-gl-rtl-text": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-rtl-text/-/mapbox-gl-rtl-text-0.2.3.tgz",
"integrity": "sha512-RaCYfnxULUUUxNwcUimV9C/o2295ktTyLEUzD/+VWkqXqvaVfFcZ5slytGzb2Sd/Jj4MlbxD0DCZbfa6CzcmMw==",
"peerDependencies": {
"mapbox-gl": ">=0.32.1 <2.0.0"
}
},
"node_modules/@mapbox/mapbox-gl-supported": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@mapbox/mapbox-gl-supported/-/mapbox-gl-supported-1.5.0.tgz",

View File

@ -9,6 +9,7 @@
"@emotion/styled": "^11.11.5",
"@fontsource/roboto": "^5.0.12",
"@mapbox/mapbox-gl-draw": "^1.4.3",
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0",
"@mui/icons-material": "^5.15.15",
"@mui/lab": "^5.0.0-alpha.170",

View File

@ -1,5 +1,6 @@
import 'maplibre-gl/dist/maplibre-gl.css';
import maplibregl from 'maplibre-gl';
import mapboxglRtlTextUrl from '@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.min.js?url'
import React, {
useRef, useLayoutEffect, useEffect, useState,
} from 'react';
@ -14,6 +15,8 @@ element.style.width = '100%';
element.style.height = '100%';
element.style.boxSizing = 'initial';
maplibregl.setRTLTextPlugin(mapboxglRtlTextUrl);
export const map = new maplibregl.Map({
container: element,
attributionControl: false,