-
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
setPaintProperty(layerId, '[icon|text]-opacity', ...) will raise on a undefined uniformName #7511
Comments
setPaintProperty(layerId, '[icon|text]-opacity', ...)
-> setUniforms
raise on undefined uniformName
Hi @ryanhamley – I'd love to but I'm afraid this might be quite hard to isolate. There's a timing factor at play which I can't seem to isolate nor figure out. Adding a breakpoint with a condition around |
We just ran into this same issue as well in the context of a satellite layer switching function. Running version 0.52.0. It doesn't happen every time but does most times. I've created a stripped down example at https://jsfiddle.net/2jvtbpwr/. If you run the Fiddle a few times you're likely to see the console error. |
@leigeber thank you for the test case! Reopening. |
This seems to be a sync issue related to #4012. Here's a reduced test case: mapboxgl.accessToken = 'pk.eyJ1IjoibGFuZHNlYXJjaCIsImEiOiJFQlRLRC1FIn0.3VCEYjxSawGQqjMKl8aitA';
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/landsearch/cjqx5v3ob4iyz2rpxuifuzpfd?optimize=true',
center: [-100.04, 38.907],
zoom: 3
});
map.on('load', function () {
map.setPaintProperty('water-line-label', 'text-color', 'red');
}); The property which is data-driven is set to constant, and there appears to be a race condition after loading tiles partially where the program tries to set text-color as a uniform even though the binders are still referring to a data-driven attribute. |
@mourner - the fix mentioned above does not seem to have made its way into the release. I am also seeing this issue, albeit I am making rather unconventional use of the API. I don't have a stripped-down example, but basically what I am doing is composing two styles together - one a Mapbox background and one from my own server, each of which has its own sprite. This follows on from a comment by @lucaswoj in a discussion on composing styles. I first get the style json for each style and compose the layers and sources into a new style without a sprite. I then download each of the sprites (png and json) and compose these together into a set of named images. I am then ready to call map.setStyle with my new style, except first I remove all images from the map (listImages, removeImage), add all the images from my set (addImage) and finally call setStyle. If I then want to switch the background (from, say, Streets to Dark) I simply repeat this process with the new pair of styles. Because there is no sprite in the style itself, I get a 'smart' setStyle that applies only the diffs, giving a very smooth update of the background with little or no flickering. Likewise when I switch between my user-defined styles. However, I also get the Uncaught Typeerror when switching between certain backgrounds. The number of such errors is typically between 1 and 5 and they occur only when switching between one of Dark or Light, and one of the other styles. I don't see them when switching Dark-Light, or Streets-Outdoor. Likewise, there is no error when switching between my user-defined styles while retaining the same Mapbox background. It's not clear what visual effect this is having, if any. There are certainly no tile-shaped holes in the map. Perhaps everything just gets sorted out on the next frame. I am intending to continue with this approach, so it would be nice to have some reassurance that these errors are either harmless or will be fixed. Thanks. |
mapbox-gl-js version: 0.50.0
browser: Chrome Version 69.0.3497.100
Context
Map with several layers (symbols and texts).
setPaintProperty(layerId, '[icon|text]-opacity', ...)
on multiple layers will sometimes raise the following error:The text was updated successfully, but these errors were encountered: