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

on_hover_text accepting a function #5608

Open
oscargus opened this issue Jan 15, 2025 · 1 comment
Open

on_hover_text accepting a function #5608

oscargus opened this issue Jan 15, 2025 · 1 comment

Comments

@oscargus
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I have a huge list of items (which happens to be part of a tree view) that all have a hover text that takes some time to generate. Not a lot, but enough to currently limit the performance of the application (for huge lists, which luckily doesn't happen very often). It would, in my case, probably be more efficient if the hover text was generated on display rather than every frame for every item (which I think is what is happening now).

Describe the solution you'd like

A method similar to on_hover_text, but that takes a function which is executes to get the hover text.

Describe alternatives you've considered

Not really.

Additional context

I am open to the fact that I am missing something due to limited Rust skills. As the list is in a tree view, it is not obvious to me if/how show_rows of the ScrollArea is used in this case.

@YgorSouza
Copy link
Contributor

There is on_hover_ui. I'm not sure about using show_rows with a tree view, though. You might be able to do a regular show, cache the offset of each item from the previous frame, and then skip the items that are out of view and just call add_space to produce the same offset, which is more or less what show_rows does. But I haven't tried that and I'm not sure if there are any pitfalls.

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