Skip to content

Commit 489ff8e

Browse files
authored
Don't set RTL text plugin if already in progress (#239)
* Don't set RTL text plugin if already in progress * Also do mapboxgl for consistency * CHANGELOG
1 parent b4a0037 commit 489ff8e

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Unreleased
22

33
- Shorten URLs by reducing map state kept in the hash to the minimum
4+
- Don't set RTL text plugin if already in progress
45

56
## 0.17.0
67

dist/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.svelte

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,16 @@
180180
$: if (settings || height || width) mapState = createMapState();
181181
182182
// Set RTL plugin once rather than per map
183-
mapboxgl.setRTLTextPlugin(
184-
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js'
185-
);
186-
maplibregl.setRTLTextPlugin(
187-
'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js'
188-
);
183+
if (mapboxgl.getRTLTextPluginStatus() === 'unavailable') {
184+
mapboxgl.setRTLTextPlugin(
185+
'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js'
186+
);
187+
}
188+
if (maplibregl.getRTLTextPluginStatus() === 'unavailable') {
189+
maplibregl.setRTLTextPlugin(
190+
'https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.2.3/mapbox-gl-rtl-text.min.js'
191+
);
192+
}
189193
</script>
190194
191195
<svelte:head>

0 commit comments

Comments
 (0)