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
Map events should accept an optional second parameter which is the name of a layer or an array of layer names for which to delegate events. Internally, this would bind an event handler that uses featuresAt and dispatches the event only when it matches features from the given layer(s). The features themselves would be passed as a member of the event object. For example:
This should not require setting interactive: true for each layer separately; binding a delegated event should automatically enable interactivity for the specified layers.
This should not require setting interactive: true for each layer separately; binding a delegated event should automatically enable interactivity for the specified layers.
This may be tricky, because you need to reparse tiles when interactive for a layer changes.
Activity
mourner commentedon Feb 17, 2015
This may be tricky, because you need to reparse tiles when
interactivefor a layer changes.lucaswoj commentedon Mar 15, 2016
We should do this as soon as #2224 lands
[-]`layer`/`layers` parameter for delegated events[/-][+]Add a "layers" parameter to "Evented#on" [/+]arthurhammer commentedon Apr 11, 2017
Playing with v0.35 and pretty happy about this change. Any plans to support multiple layers to query with
on?anandthakker commentedon Apr 11, 2017
Seems like a doable enhancement to me -- @jfirebaugh did you encounter any subtleties in implementing this that would make this problematic?
mourner commentedon Apr 11, 2017
Looks like a one-line change to me since underlying
queryRenderedFeaturesalready accepts an array of layer ids.jfirebaugh commentedon Apr 11, 2017
Yeah, should be straightforward. @arthurhammer can you open a new issue so we don't lose track of the request?
arthurhammer commentedon Apr 12, 2017
Done in #4578. Thanks!