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

Access to layer inside HoverTooltip #358

Closed
sronveaux opened this issue Nov 14, 2023 · 4 comments
Closed

Access to layer inside HoverTooltip #358

sronveaux opened this issue Nov 14, 2023 · 4 comments

Comments

@sronveaux
Copy link
Collaborator

Hi team,

This is more a question than a real issue I think... this one could be for @fschmenger as he's the man behind the excellent Generalized Feature Hover functionality:

I have a case where the same source (a collection of Feature objects) is assigned to multiple layers each having a different styling function and each showing up different data inside an overlay. The data to be shown is associated with the layers, not the features as those layers are dynamic and created on-the-fly. They are not part of the config file.
To avoid creating multiple HoverTooltip components, I could easily extract the data I want to display depending on the hovered layer. However, there currently is no way to know which layer is hovered inside a MapOverlay, only the feature.

In the code, the HoverController receives feature-layer pairs inside its displayTooltip function but forwards only the feature to the MapOverlay afterwards. Would you mind if I open a PR where the layer is forwarded next to the feature to the MapOverlay or is there another way and I missed something ?

Thanks in advance,
Sébastien

@fschmenger
Copy link
Collaborator

Hi Sebastien, I had no time to dig very deep but I couldn`t think of a way to obtain the layer easily and I also see no downside from forwarding it to the MapOverlay.
Cheers Felix

@sronveaux
Copy link
Collaborator Author

Hi Felix, thanks for the fast reply, that's perfect, I'll create a small PR shortly to address this...

Cheers,
Sébastien

@sronveaux
Copy link
Collaborator Author

Implemented in #359

@fschmenger
Copy link
Collaborator

Ah good catch, just in case you aren`t aware: You can autoclose issues via commit messages in the respective PRs, see e.g. https://github.blog/2013-01-22-closing-issues-via-commit-messages/ :)

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

2 participants