Atom support for egui::Window Titlebar#8154
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/8154-lucaswindow-title-atom View snapshot changes at kitdiff |
|
Clarify what size now means (does it include the frame / margins?). |
# Conflicts: # crates/egui/src/containers/resize.rs # crates/egui_kittest/tests/regression_tests.rs
- Reorder `use super::{...}` to satisfy rustfmt.
- Allow `clippy::too_many_arguments` / `clippy::fn_params_excessive_bools`
on `title_ui` (already over the threshold).
- Pass `&child_ui` instead of `&mut child_ui` to `CollapsingState::toggle`.
The `IntoAtoms` upgrade lives on `lucas/small-button-atom` and will be PR'd separately. Drop it here so the two PRs don't overlap.
Fixes to get emilk/egui#8154 to show correctly
Yeah. I could make it exclude outer margins, but it makes the positioning code a bit more complex and I think it's generally weird to have an outer margin on windows? So I decided to keep it like this. (But I've updated the test to check outer margin behavior). |
|
The vertical spacing has changed in a lot of the screenshots 🤔 Seems like the title bar has grown or shrunk by a fraction of a pixel. I wonder why 🤔 For instance: check the Not necessarily worse; just different 🤷 |
|
Ah the cursor isn't pixel aligned: I'll try to find the root of this or add some rounding Edit: Ah I think this is fine actually, at least we do call gui_round on the allocated rect, so I think it's fine? |
The resize fix allows use to really simplify how the Window Titlebar is rendered. Previously it was using some complex flow to calculate and allocate the height first and then render it later once we knew the windows final width.
Since now windows can't shrink past their minimum content widths, I can just show the titlebar inline with the regular content, just outside of the
Resizecontainer so that it is always visible.This does change what the size of a window means. Before, size was just the size of the contents, while now size (e.g. via min_height) will include the Frames margin and outline, title bar and the contents.
Also, the window label now truncates as you shrink the window (meaning windows can now be smaller than their label allows).