-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #964 from eo-uk/fix-rtlplugin
fixed rtl plugin error on loading it twice
- Loading branch information
Showing
1 changed file
with
9 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,15 @@ async function MaplibreGL() { | |
|
||
maplibregl = imports[0] | ||
|
||
// Avoid loading RTL Text Plugin twice, else it will error | ||
if (!["deferred", "loaded"].includes(maplibregl.getRTLTextPluginStatus())) { | ||
maplibregl.setRTLTextPlugin( | ||
'https://unpkg.com/@mapbox/[email protected]/mapbox-gl-rtl-text.min.js', | ||
null, | ||
true // Lazy load the plugin | ||
); | ||
} | ||
|
||
resolve() | ||
}) | ||
.catch(error => { | ||
|
@@ -34,11 +43,6 @@ async function MaplibreGL() { | |
|
||
await promise | ||
|
||
maplibregl.setRTLTextPlugin( | ||
'https://unpkg.com/@mapbox/[email protected]/mapbox-gl-rtl-text.min.js', | ||
null, | ||
true // Lazy load the plugin | ||
); | ||
|
||
return new maplibregl.Map(...arguments); | ||
} | ||
|