Skip to content

Commit

Permalink
fixed rtl plugin error on loading it twice
Browse files Browse the repository at this point in the history
  • Loading branch information
eo-uk committed Oct 13, 2023
1 parent f37c0da commit d7ce6a1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/layer/format/maplibre.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ 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
);
// 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
);
}

return new maplibregl.Map(...arguments);
}
Expand Down

0 comments on commit d7ce6a1

Please sign in to comment.