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

Temporarily suspend interactivity if layer is not "on top" #391

Closed
prushforth opened this issue Apr 13, 2021 · 2 comments · Fixed by #395
Closed

Temporarily suspend interactivity if layer is not "on top" #391

prushforth opened this issue Apr 13, 2021 · 2 comments · Fixed by #395

Comments

@prushforth
Copy link
Member

prushforth commented Apr 13, 2021

When adding templated layer of whatever type, layers with vector data lower in the z-order currently retain their interactivity, such as links and popups.

This issue is to discuss how to handle interactivity in lower (non-top) layers.

I think it would add coherence to the product if we applied the "only the top layer can be queryable OR interactive" rule, so that only the top most layer can be interactive, regardless of whether it's feature data or queryable imagery.

In a native code implementation, we'll hopefully see, perhaps interactivity could be determined at the graphics level: whatever layer rendered the final topmost value of a pixel could get to make that pixel interactive.

@Malvoz
Copy link
Member

Malvoz commented Apr 14, 2021

I think it would add coherence to the product if we applied the "only the top layer can be queryable OR interactive" rule, so that only the top most layer can be interactive, regardless of whether it's feature data or queryable imagery.

I think this would be a bit unfortunate though as it'd be quite limiting on both authors and users. e.g. if the author wants to display 2 sets of layers with markers I assume only 1 set of markers would be interactive even if both sets are visible. Users would have to toggle layers to be able to interact with the otherwise non-interactive markers. And maybe that's fine in a polyfill, or it's expected of us to solve things like this...

With the risk of complicating things - my specialty - I wonder if we can hack this using mix-blend-mode (#305):

.mapml-layer {
  mix-blend-mode: multiply;
}

No mix-blend-mode (current)

With mix-blend-mode: multiply

(some features have transparency, which doesn't seem ideal for e.g. markers)

With mix-blend-mode: darken

(some features are seemingly not transparent, e.g. markers)

This blend hack may be using mix-blend-mode naively, even if improved it may still not be perfect, but it allows preserving interactivity of all features since they're now visible to the user.

But, we'd still have the issue of having 2 or more interactive features stacked on top each other (whether belonging to same or different layer), touch- and mouse pointer users would still have to re-order layers to interact with the initially underlying one. A Feature Index could allow these users to interact with stacked features.

@ahmadayubi
Copy link
Member

In the PR instead of only making the top layer interactive, it just checks for a queryable layer on top, if it has one then the layer losses intractability, if not then it remains interactive even if there are other layers on top, as long as the feature is visible and clicked it'll follow the feature link rules.

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

Successfully merging a pull request may close this issue.

3 participants