Skip to content

Add hover inputs in Shiny with enable_shiny_hover() - #114

Merged
walkerke merged 3 commits into
mainfrom
hover-performance-optimization
Jun 15, 2025
Merged

Add hover inputs in Shiny with enable_shiny_hover()#114
walkerke merged 3 commits into
mainfrom
hover-performance-optimization

Conversation

@walkerke

Copy link
Copy Markdown
Owner

No description provided.

@walkerke
walkerke merged commit 094fbda into mainJun 15, 2025
@walkerke
walkerke deleted the hover-performance-optimization branch June 15, 2025 14:27
@kmcd39

Copy link
Copy Markdown
Contributor

i just pushed changes to my branch that allow a layer argument for the hover observer!

This is pretty much all it takes in the JS:

const options = x.hover_events.layer_id ? { layers: [x.hover_events.layer_id] } : undefined;
const features = map.queryRenderedFeatures(e.point, options);

and adding the option for the layer_id argument in the enable_shiny_hover R fcn. I can open a PR later if we want

@walkerke

Copy link
Copy Markdown
OwnerAuthor

@kmcd39 awesome! feel free to open a PR but I can probably just plug that in if that's all we need to do. appreciate that! another user just requested it, so perfect timing.

@walkerke

Copy link
Copy Markdown
OwnerAuthor

@kmcd39 this is now implemented! I used your code but just adapted slightly to allow users to pass a vector of layer IDs if they want to target multiple layers on hover. Thank you for contributing!

@kmcd39

Copy link
Copy Markdown
Contributor

okay amazing!!
I was on other projects for a while (and tbh am quite new to just github for actual collaborations) but just did a pull request to include the get_viewpoint_features as well, if you think that's worth including.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@walkerke@kmcd39