-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Event binding of Layer #1997
Comments
Thanks for filing this @lsbFlying, I agree that this should be a supported feature. Do you have a workaround at the moment? I'm facing a scenario where I have dozens of layers that need to be seamlessly mounted/unmounted/remounted as the user interacts with my application. Routing these events through |
any update on this one ? |
@lsbFlying, You can freely interact with your layers with the The only trick here is that you have to use your Map's component In your case you will have to pass the layer id to the map
This is how I handle this in my app, and it works without any issues. I agree this is going to be quite messy (as danielvaughn mentioned above) when handling multiple layers and binding different actions/behaviours to them through the Map's onClick method but this is the only way that I can think of right now. |
Hi, sorry to open an old thread here, but I'm not confident this actually works. @bartlomiejwendt would you be willing to share code where you used this? This pattern is used in the clusters example, but doesn't work, because EDIT: nevermind, see: #2243 (comment) |
Target Use Case
<Layer
type="fill"
id="chinaLayerFill"
paint={{
"fill-opacity": 0.35,
"fill-color": "#107DB3",
}}
// Expected support
// onClick={(e) => { ... }}
// onXXX={(e) => {}}
/>
Proposal
Because there are general business requirements, you only want to process binding events on certain layers
The text was updated successfully, but these errors were encountered: