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

Context menu & hover box width is sometimes too narrow #6801

Open
Wumpf opened this issue Jul 8, 2024 · 6 comments
Open

Context menu & hover box width is sometimes too narrow #6801

Wumpf opened this issue Jul 8, 2024 · 6 comments
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working egui Requires egui/eframe work ui concerns graphical user interface

Comments

@Wumpf
Copy link
Member

Wumpf commented Jul 8, 2024

I'm not sure how I exactly got into this state, but the context appeared sometimes wide and sometimes narrow depending on the item:

context.menu.mp4

Once (not captured on video) I got an even narrower context menu which had only space for 1-2 characters.

(0.17rc2 @ Windows)

@Wumpf Wumpf added ui concerns graphical user interface 😤 annoying Something in the UI / SDK is annoying to use labels Jul 8, 2024
@Wumpf
Copy link
Member Author

Wumpf commented Jul 8, 2024

The same seems to happen with tooltips
image

@emilk emilk added 🪳 bug Something isn't working egui Requires egui/eframe work labels Jul 8, 2024
@emilk emilk changed the title Context menu width depends seemingly random on where it was clicked Context menu width is sometimes too narrow Jul 8, 2024
@emilk
Copy link
Member

emilk commented Jul 8, 2024

There's nothing random in your video - it seems to depend 100% on which element was clicked

@Wumpf
Copy link
Member Author

Wumpf commented Jul 8, 2024

Not in the video, itself but

  • it's unclear what's special about the second item
  • The behavior hasn't been consistent over my overall Rerun session

@emilk
Copy link
Member

emilk commented Jul 8, 2024

I could see this bug happening if the context menu changes content over time. If a given context menu is narrow the first time it is shown, it will remember this narrowness and then in the future break new elements to this width.

If this is indeed the problem, there are few different fixes to consider:
A) change the Id of the context menu based on its content
B) remove line wrapping from context menus

emilk added a commit that referenced this issue Jul 8, 2024
@Wumpf Wumpf changed the title Context menu width is sometimes too narrow Context menu & hover box width is sometimes too narrow Sep 24, 2024
@emilk
Copy link
Member

emilk commented Sep 25, 2024

I suspect this only happens when pixels-per-point is non-integer, due to some rounding problem, perhaps same problem as in emilk/egui#5084.

The idea would be: we lay out the contents of the popup with a wide max_size/wrap-width. The text does not wrap, and the non-wrapped size of the text is reported up the Ui chain and the final size is then stored for the Area. This size is then set as the max_size on subsequent frames, but due to some rounding error, the text will now wrap, despite the width presumably being exactly the width where it does not need to wrap.

I've tried to avoid this issue in epaint/egui by rounding text widths up to the nearest integer point width, but obviously there is still some bug somewhere. I'm investigating…

emilk added a commit that referenced this issue Sep 25, 2024
Wumpf added a commit that referenced this issue Sep 25, 2024
* Had this fix in it: emilk/egui#5161
* #6801 is NOT fixed by this PR
:(

@Wumpf you had a pretty solid repro of this yesterday - please test 🙏 

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7509?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/7509?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!
* [x] If have noted any breaking changes to the log API in
`CHANGELOG.md` and the migration guide

- [PR Build Summary](https://build.rerun.io/pr/7509)
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.

---------

Co-authored-by: Andreas Reich <andreas@rerun.io>
@emilk
Copy link
Member

emilk commented Sep 25, 2024

I think the original issue with shrinking menus was mostly solved by

But for menus with dynamic content we need a proper fix for:

The tooltip issue is a separate one:

@emilk emilk removed their assignment Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working egui Requires egui/eframe work ui concerns graphical user interface
Projects
None yet
Development

No branches or pull requests

2 participants