You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class attribute visibility is not initialized.
Fetching map.getLayoutProperty("......", 'visibility'); returning undefined if not set explicitly before.
The text was updated successfully, but these errors were encountered:
We've recently been discussing this issue in general (not just related to 'visibility'). I think that this is true about all properties. It's fair to be concerned about this.
I'll try to get this discussion resolved, we may change this behavior (it's confusing) but it's maybe a historical issue we won't fix. Changes to existing semantics or API of the style-spec are unlikely because we highly value compatibility. Fixing this would be a major change in my opinion.
Just wanted to add, that I don't necessarily believe this is wrong behaviour, since a default of undefined implies that the layer property has never been set before.
Regarding the documenation at https://docs.mapbox.com/mapbox-gl-js/style-spec/#layer-layout - it does say it is an optional enum. Maybe just update the docs to say that undefined is returned for properties that are not explicitly set at layer creation time.
This will avoid having to make any changes to the library and hurting compatibility as you mentioned.
background
visibility
Layout property. Optional enum. One of "visible", "none". Defaults to "visible".
Whether this layer is displayed.
"visible":
The layer is shown.
"none":
The layer is not shown.
The class attribute visibility is not initialized.
Fetching map.getLayoutProperty("......", 'visibility'); returning undefined if not set explicitly before.
The text was updated successfully, but these errors were encountered: