-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTL text plugin is not applied to styles initialized after the plugin is loaded #4859
Comments
cc @ChrisLoer |
Thanks for the super-clear report, @petrsloup. There's a race condition here. The first time you create a style, we start running background web workers. When you register the RTL text plugin, we send a notification to the web workers to load the code. The code assumes the workers will be running before the plugin becomes available, but in your example that's not the case, because the plugin has a chance to fully load before your initial call to We'll fix the bug, but until then note that the bug only applies to the ordering of the initial |
Oh, I see. Thanks for the workaround. |
Err, my race condition explanation was totally bogus. 😅 Turns out to be a simple regression I introduced in 171db61 by passing the wrong arguments to the plugin registration callback in the case the plugin was already available. |
Hello, I am still experiencing the same issue on rerenders. Is there a way to detect that |
Reopening this since it seems to have regressed as per report in #9087 |
This seems to we working for me with gl-js https://jsbin.com/digepuxaze/edit?html,output |
if anyone still looking i found this solution : |
When you use this code snippet after the map initialization, you get the the following error.
As you can guess, the if (mapboxgl.getRTLTextPluginStatus !== 'loaded') {
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.0/mapbox-gl-rtl-text.js');
} |
mapbox-gl-js version: 0.38.0
Steps to Trigger Behavior
mapboxgl.setRTLTextPlugin('https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.1.1/mapbox-gl-rtl-text.js');
setStyle
is enough) after the plugin is loadedCompare:
https://jsbin.com/kepafevoho/edit?html,output (style passed via constructor)
https://jsbin.com/lixutelitu/edit?html,output (style set via
setStyle
after 1 s timeout)Expected Behavior
The RTL texts should be displayed correctly even when using
setStyle
.The two demos above should produce visually equal results.
Actual Behavior
The RTL does not work (the map does not seem to know about the plugin, but calling
setRTLTextPlugin
throwssetRTLTextPlugin cannot be called multiple times.
.Looks like the plugin is only "applied" on the existing map and style once after it is loaded... ?
The text was updated successfully, but these errors were encountered: