mapbox-gl-js icon indicating copy to clipboard operation
mapbox-gl-js copied to clipboard

Making click event to accept multiple layers

Open shabnomnom opened this issue 6 years ago • 5 comments

Motivation

Sometimes users would like to select a mouse event from the top most features where the features span across multiple layers. Since the event API only accepts single layer ID, developers have to combine events somehow.

Design Alternatives

Enabling the same design for the event listener as map.queryRenderedFeatures where you can pass a feature from an array of features.

For example: map.on('click', ['layer-id-1', 'layer-id-2'], function() {})

shabnomnom avatar Sep 22 '20 04:09 shabnomnom

Nice feature, looking forward to it.

gongzemin avatar Feb 23 '21 07:02 gongzemin

I have the same needs

ethan-zf avatar Mar 18 '21 07:03 ethan-zf

I'm sure a lot of people would love that feature (I'm one of them)

MuhammadMotawe avatar Aug 10 '21 04:08 MuhammadMotawe

can I take this as my first contrib?

omerbn avatar Aug 20 '21 11:08 omerbn

PR: https://github.com/mapbox/mapbox-gl-js/pull/10954

omerbn avatar Aug 20 '21 15:08 omerbn