Skip to content

Commit

Permalink
Merge pull request #964 from eo-uk/fix-rtlplugin
Browse files Browse the repository at this point in the history
fixed rtl plugin error on loading it twice
  • Loading branch information
dbauszus-glx authored Oct 13, 2023
2 parents f37c0da + c421771 commit f0bdac3
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/layer/format/maplibre.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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);
}
Expand Down

0 comments on commit f0bdac3

Please sign in to comment.