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

Support array of layers for map.on #5211

Closed
stevage opened this issue Aug 31, 2017 · 5 comments
Closed

Support array of layers for map.on #5211

stevage opened this issue Aug 31, 2017 · 5 comments

Comments

@stevage
Copy link
Contributor

stevage commented Aug 31, 2017

Currently you can do this:

    map.on('mouseenter', 'my-points', function(e) {...});

But if you want the same behaviour on multiple layers, you can't do it directly:

   var f = function(e) {
    ...
   };
    map.on('mouseenter', 'my-points', f);
    map.on('mouseenter', 'my-other-points', f);

It would seem reasonable to expect to be able to do:

    map.on('mouseenter', ['my-points', 'my-other-points'], function(e) { ... })`
@jfirebaugh
Copy link
Contributor

See #4578 for why we elected not to support this.

@stevage
Copy link
Contributor Author

stevage commented Aug 31, 2017 via email

@Stephane-Ag
Copy link

The documentation makes it seem like this is now a feature but it does not work for me. I have "mapbox-gl": "1.6.1".
What version was this introduced? Any link to a new PR with why it was eventually added?

@stevage
Copy link
Contributor Author

stevage commented May 3, 2023

@Stephane-Ag You are many major versions behind the latest release.

@Stephane-Ag
Copy link

@stevage I know that which is why I included my version. That answer does not help with either of my questions.

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

3 participants