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

Update to egui 0.29 #155

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Conversation

crumblingstatue
Copy link
Contributor

Also fixes some deprecations and lints

Known problems

  • The save file dialog in the example seems to keep expanding unbounded.
    Gonna have to look into the cause of that.

Also fixes some deprecations and lints
@fluxxcode
Copy link
Owner

fluxxcode commented Sep 26, 2024

Thank you for the PR! I think the problem in save file mode is that there is something wrong with the calculation of the width of the file name input. I'll take a look too

Edit: nvm the problem is the height and not the width

@fluxxcode fluxxcode merged commit 875dcac into fluxxcode:develop Sep 26, 2024
1 check passed
@crumblingstatue crumblingstatue deleted the egui-0.29 branch September 26, 2024 19:12
@crumblingstatue
Copy link
Contributor Author

crumblingstatue commented Sep 26, 2024

Do you have a solution for the problem, or should I keep looking?

ui.add_sized() seems to work around the problem, but not sure what the best height to use here.

@fluxxcode
Copy link
Owner

I'm currently debugging, but haven't found a fix yet.
It seems to me that there is an error in the new Text Edit fields with the height.

Is the height of the text edit fields specified somewhere in the styles/or visuals?

@fluxxcode
Copy link
Owner

ui.add_sized() seems to work around the problem, but not sure what the best height to use here.

Height >= 15 works fine, anything less causes the error again.

@crumblingstatue
Copy link
Contributor Author

Is the height of the text edit fields specified somewhere in the styles/or visuals?

Not sure, I was wondering as well. I think it depends on the font configuration, so we would have to look at that to determine the size, I belive.

The changelog talks about a new sizing pass, not sure if utilizing that would be a better long-term solution to avoid such issues.
Although I have no idea how to use it.

I asked Emil on discord what he thinks about this problem, as it's technically a regression. I'm waiting on response.

@fluxxcode
Copy link
Owner

At first glance, the sizing pass looks pretty useful, but I also have no idea how to use it at the moment.

Found the following TODO:

        // TODO(emilk): return full outer_rect in `TextEditOutput`.
        // Can't do it now because this fix is ging into a patch release.
        let outer_rect = output.response.rect;
        let inner_rect = outer_rect - margin;
        output.response.rect = inner_rect;

https://github.com/emilk/egui/blob/59d71831fd43139bf9b427b779a241099b9c9826/crates/egui/src/widgets/text_edit/builder.rs#L416

Maybe the problem has something to do with that.

As a workaround, we could use ui.fonts(|f| f.row_height(&egui::TextStyle::Body.resolve(ui.style()))) to get the height of the text and then add a margin. 1.0 works quite well, but the question is whether the margin around the text in an input field is set dynamically or is hardcoded.

@crumblingstatue
Copy link
Contributor Author

That seems to be from a commit from 6 months ago, so I'm not sure how relevant it is, since the problem didn't seem to manifest in 0.28.

@fluxxcode
Copy link
Owner

True, I hadn't seen that. Ye, then that has nothing to do with it

@crumblingstatue
Copy link
Contributor Author

Emil asked me to file a bug report, so I did.
emilk/egui#5173

@crumblingstatue
Copy link
Contributor Author

Just as an update, the issue has been fixed on egui git master.
A patch release should come in the next few days.

@fluxxcode
Copy link
Owner

Thanks for the update! Will create a new version for the file dialog once the egui patch is released

@crumblingstatue
Copy link
Contributor Author

egui 0.29.1 has been released

@fluxxcode fluxxcode mentioned this pull request Oct 1, 2024
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

Successfully merging this pull request may close these issues.

2 participants