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

egui: Fixed the incorrect display of the Window frame with a wide border or large rounding #4032

Merged
merged 11 commits into from
Mar 8, 2024

Conversation

varphone
Copy link
Contributor

@varphone varphone commented Feb 12, 2024

Currently, the Window frame is displayed incorrectly when using a wide border or large rounding.

window-frame-bug.webm
  • Screencast of egui demo app (varphone:hotfix/window-custom-frame)
window-frame-fixed.webm

@rustbasic
Copy link
Contributor

rustbasic commented Feb 13, 2024

@varphone

Thank you for your hard work on this time-consuming task. It is greatly appreciated.

Pressing collapse, depending on whether the window has focus or not,
the border at the bottom or right end of the title is infringed by about 0.5 to 1.0 (border.width 1.0 ~ 2.0).

Adding two lines below line 397 of window.rs improves it somewhat, but it's not perfect.

        let window_margin = window_frame.inner_margin;
        let border_stroke = ctx.style().visuals.widgets.noninteractive.bg_stroke;
        window_frame.inner_margin = window_frame.inner_margin + Margin::same(border_stroke.width);

@varphone
Copy link
Contributor Author

varphone commented Feb 13, 2024

@varphone

Thank you for your hard work on this time-consuming task. It is greatly appreciated.

Pressing collapse, depending on whether the window has focus or not, the border at the bottom or right end of the title is infringed by about 0.5 to 1.0 (border.width 1.0 ~ 2.0).

Adding two lines below line 397 of window.rs improves it somewhat, but it's not perfect.

        let window_margin = window_frame.inner_margin;
        let border_stroke = ctx.style().visuals.widgets.noninteractive.bg_stroke;
        window_frame.inner_margin = window_frame.inner_margin + Margin::same(border_stroke.width);

@rustbasic

Issue resolved in commit 4d2edb5

@rustbasic
Copy link
Contributor

@varphone

This is good.
thank you

The border at the right end of the title is violated by about 0.1 to 0.5.
You can tell by looking closely at the color window.
I don't think it's a big worry.

I think we both had a good collaboration. Of course your power was greater.
have a good day.

@rustbasic
Copy link
Contributor

rustbasic commented Feb 13, 2024

@varphone

Dear varphone

I recently planned to find a solution to symptom #3730.

#3730 Do you have any symptoms?

If symptoms occur, do you solve them together ?

@varphone
Copy link
Contributor Author

@varphone

This is good. thank you

The border at the right end of the title is violated by about 0.1 to 0.5. You can tell by looking closely at the color window. I don't think it's a big worry.

I think we both had a good collaboration. Of course your power was greater. have a good day.

Currently shrink by 0.1 to prevent the title bar hline from infringing the border,
To completely solve the problem should be calculated using TessellationOptions::feathering_size_in_pixels,
But now it works perfectly for most use cases.

79a8cc7

@varphone
Copy link
Contributor Author

@varphone

Dear varphone

I recently planned to find a solution to symptom #3730.

#3730 Do you have any symptoms?

If symptoms occur, do you solve them together ?

Dear rustbasic

This scenario hasn't been encountered yet. Further testing will be conducted when time permits.

@rustbasic
Copy link
Contributor

Currently shrink by 0.1 to prevent the title bar hline from infringing the border, To completely solve the problem should be calculated using TessellationOptions::feathering_size_in_pixels, But now it works perfectly for most use cases.

79a8cc7

@varphone
I mean the right end of the title, not the hline() line below the title.
You did a really good job today.
Take a good rest.

@emilk emilk added the egui label Feb 16, 2024
crates/egui/src/containers/resize.rs Show resolved Hide resolved
crates/egui/src/containers/window.rs Outdated Show resolved Hide resolved
@emilk emilk merged commit a93c6cd into emilk:master Mar 8, 2024
19 checks passed
hacknus pushed a commit to hacknus/egui that referenced this pull request Oct 30, 2024
…order or large rounding (emilk#4032)

Currently, the Window frame is displayed incorrectly when using a wide
border or large rounding.

* Closes emilk#3806
* Closes emilk#4024 
* Closes emilk#4025 

* Screencast of egui demo app (emilk:master)


[window-frame-bug.webm](https://github.com/emilk/egui/assets/1274171/391f67fa-ae6f-445a-8c64-1bb575770127)

* Screencast of egui demo app (varphone:hotfix/window-custom-frame)


[window-frame-fixed.webm](https://github.com/emilk/egui/assets/1274171/1953124e-9f7a-4c2d-9024-5d2eece6b87c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Width of the window title bar with custom frame Window title bar border disappears
3 participants