Skip to content
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

Attribute Visibility of class StyleLayer (src/style/style_layer.js) not initialized #8654

Open
uid01089 opened this issue Aug 17, 2019 · 2 comments

Comments

@uid01089
Copy link

The class attribute visibility is not initialized.
Fetching map.getLayoutProperty("......", 'visibility'); returning undefined if not set explicitly before.

@ahk
Copy link
Contributor

ahk commented Aug 23, 2019

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.

@puiutucutu
Copy link

puiutucutu commented Sep 17, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants