From c43a2f7e660e660b978dc9b5c971f0d4ff5d6d1b Mon Sep 17 00:00:00 2001 From: George Owen Date: Thu, 19 Oct 2023 10:47:10 -0700 Subject: [PATCH] add rtl support and example #206 --- examples/languages.html | 5 +++- examples/rtl-language.html | 58 ++++++++++++++++++++++++++++++++++++++ package.json | 3 +- src/EsriLeafletVector.js | 2 +- src/MaplibreGLLayer.js | 4 +++ 5 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 examples/rtl-language.html diff --git a/examples/languages.html b/examples/languages.html index 72d256c..b79882f 100644 --- a/examples/languages.html +++ b/examples/languages.html @@ -44,7 +44,7 @@ }).setView([35.7088, 48.8790], 4); - const apiKey = "< YOUR VALID API KEY HERE >"; + const apiKey = "< YOUR ARCGIS API KEY HERE >"; const basemapStyle = "arcgis/outdoor"; @@ -98,6 +98,9 @@ L.control.layers(basemapLayers, null, { collapsed: false }).addTo(map); + // Support RTL languages such as Arabic and Hebrew + L.esri.Vector.setRTLTextPlugin('https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.js'); + diff --git a/examples/rtl-language.html b/examples/rtl-language.html new file mode 100644 index 0000000..176de73 --- /dev/null +++ b/examples/rtl-language.html @@ -0,0 +1,58 @@ + + + + + + Esri Leaflet Vector: RTL language support + + + + + + + + + + + + + + + + + +
+ + + diff --git a/package.json b/package.json index 92c60c4..61cc563 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "contributors": [ "Patrick Arlt (http://patrickarlt.com)", "Gavin Rehkemper (https://gavinr.com)", - "Jacob Wasilkowski (https://jwasilgeo.github.io)" + "Jacob Wasilkowski (https://jwasilgeo.github.io)", + "George Owen (https://geowen.dev/)" ], "bugs": { "url": "https://github.com/Esri/esri-leaflet-vector/issues" diff --git a/src/EsriLeafletVector.js b/src/EsriLeafletVector.js index bdabf58..80a1c90 100644 --- a/src/EsriLeafletVector.js +++ b/src/EsriLeafletVector.js @@ -6,4 +6,4 @@ export { version as VERSION }; export { VectorBasemapLayer, vectorBasemapLayer } from './VectorBasemapLayer'; export { VectorTileLayer, vectorTileLayer } from './VectorTileLayer'; export { EsriUtil as Util } from './Util'; -export { MaplibreGLJSLayer, maplibreGLJSLayer } from './MaplibreGLLayer'; +export { MaplibreGLJSLayer, maplibreGLJSLayer, setRTLTextPlugin } from './MaplibreGLLayer'; diff --git a/src/MaplibreGLLayer.js b/src/MaplibreGLLayer.js index 3ca9552..4184187 100644 --- a/src/MaplibreGLLayer.js +++ b/src/MaplibreGLLayer.js @@ -9,6 +9,10 @@ import { } from 'leaflet'; import maplibregl from 'maplibre-gl'; +export const setRTLTextPlugin = (url, callback, deferred) => { + maplibregl.setRTLTextPlugin(url, callback, deferred); +}; + export var MaplibreGLJSLayer = Layer.extend({ options: { updateInterval: 32,