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

Upgrade to egui 0.21 #8

Closed
Kryptos-FR opened this issue Mar 28, 2023 · 5 comments
Closed

Upgrade to egui 0.21 #8

Kryptos-FR opened this issue Mar 28, 2023 · 5 comments

Comments

@Kryptos-FR
Copy link
Contributor

I noticed some commits in master branch about upgrading to egui v0.21 (194e9ad).

It seems to work on my end building from master, though I also noticed that a piece of code was removed examples/simple/frame_history.rs#L81-L98.

Is there anything we can do to help?

@Hirtol
Copy link
Owner

Hirtol commented Mar 28, 2023

On my end I noticed that several things seemed broken/changed for the worse in the 0.21 update.
All running on the simple example.

For example, cell editing no longer shows the text you put in, this cell should show an E at the moment:
image

There also seems to be a weird clipping issue due to the new update, extending past the top bar for any reason (more than 15 columns) makes egui clip all the content (without the top bar the whole ScrollArea seems to allocate no space at all and gets clipped?). Example below, notice how the ASCII display is cut off to only 3 characters:
image

Everything else still seemed to work, but I found the clipping issue egregious enough to not push a new update to crates.io. Haven't looked much at it since (and couldn't find anything in the changelog mentioning clipping changes).

If you feel like looking at that issue I certainly wouldn't mind! It's the main blocker for a new release.

@Kryptos-FR
Copy link
Contributor Author

Kryptos-FR commented Mar 28, 2023

For the first issue, it looks like something has changed around the layouting of characters or the default monospace font might have different properties.
Setting a value of 14 for the desired_width seems to almost fix it.

let response = ui.add(
    TextEdit::singleline(&mut frame_data.selected_edit_address_string)
-       .desired_width(6.0)
+       .desired_width(14.0)
        .font(options.memory_editor_text_style.clone())
        .hint_text(label_text)
        .id_source(frame_data.selected_edit_address),

Or it could be that there was an invisible carriage return character before, which is now taking zero space thanks to emilk/egui#2452.

@Kryptos-FR
Copy link
Contributor Author

For the scroll area, it is funny since the changelog mention that it should be less aggressive about clipping its contents but here it is exactly the opposite. This regression was likely introduced by emilk/egui#2665. I guess you should open a bug in egui repo.

Hirtol added a commit that referenced this issue Mar 28, 2023
@Hirtol
Copy link
Owner

Hirtol commented Mar 28, 2023

For the first issue, it looks like something has changed around the layouting of characters or the default monospace font might have different properties. Setting a value of 14 for the desired_width seems to almost fix it.

let response = ui.add(
    TextEdit::singleline(&mut frame_data.selected_edit_address_string)
-       .desired_width(6.0)
+       .desired_width(14.0)
        .font(options.memory_editor_text_style.clone())
        .hint_text(label_text)
        .id_source(frame_data.selected_edit_address),

Or it could be that there was an invisible carriage return character before, which is now taking zero space thanks to emilk/egui#2452.

That was indeed quite close! Turns out it's usually around 14.3. I've updated it so that it's exactly the width of the other columns to prevent jitter.

You still can't see the full value you're editing, but it's definitely better than before.

@Hirtol
Copy link
Owner

Hirtol commented Mar 28, 2023

Never mind, the issue with the clipping was caused due to a change in ui.min_rect() which seems to have changed somewhat in 0.21.

Changing the shrink_window_ui function to rely purely on previous frame data seems to have fixed that in this commit: dd402c7

I'll push a release tomorrow if there are no other issues.
Thanks for having a look!

@Hirtol Hirtol closed this as completed Mar 29, 2023
Kryptos-FR added a commit to fragcolor-xyz/shards that referenced this issue Mar 29, 2023
Kryptos-FR added a commit to fragcolor-xyz/shards that referenced this issue Mar 29, 2023
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