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

Layers should have visible and selectionAPI functions #674

Closed
manthey opened this issue Mar 2, 2017 · 3 comments
Closed

Layers should have visible and selectionAPI functions #674

manthey opened this issue Mar 2, 2017 · 3 comments

Comments

@manthey
Copy link
Contributor

manthey commented Mar 2, 2017

We can toggle the visibility and interactivity of individual features with the visible() and selectionAPI() functions. It would be nice if these were exposed for layers, so an entire layer (regardless of type) could be hidden or selections disabled (though the interaction option might only be appropriate for feature layers).

Currently, you can hide a layer by changing is opacity, but it still interacts and renders.

@manthey
Copy link
Contributor Author

manthey commented Mar 28, 2017

A visible() layer function will be added in an upcoming PR.

We currently have an active flag we can pass when we create a layer. The only affect this has is whether the layer has a css class of active, which sets the layer's css to pointer-events: auto (otherwise it is none).

Once a layer is created, we don't have an API for changing the active flag (it would be trivial to have one) other than manually toggling the layer's css class.

Should a selectionAPI state of a layer match that of its active state? For features, we disable event hooks when we turn off the selection API. I imagine that we would cascade that down from the layer, so toggling the layer would do the same. The active state, on the other hand, determines if the layer receives mouse (pointer) events itself, and is orthogonal to our selection API (since that is based on the map receiving mouse events).

Or should selectionAPI be orthogonal to active?

@manthey
Copy link
Contributor Author

manthey commented Mar 28, 2017

PR #682 adds visible() and selectionAPI() functions to layers. If either is false, then subcomponents (such as features) act as if their values are also false. The active setting on a layer can now be changed (it is independent of selectionAPI).

@manthey
Copy link
Contributor Author

manthey commented Apr 13, 2017

Added in PR #682.

@manthey manthey closed this as completed Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant