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

Improve Frame API to allow picking color until after adding content #3889

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

emilk
Copy link
Owner

@emilk emilk commented Jan 25, 2024

Previously the Frame API only supported picking colors once, and then adding widgets.

But what if you want to add widgets first, and THEN pick the colors for the frame? Now you can!

let frame = Frame::default().inner_margin(4.0).begin(ui);
{
    frame.content_ui.label("Inside the frame");
    frame.content_ui.label("This too");
}
let response = frame.allocate_space(ui);
if response.hovered() {
    frame.frame.stroke = Stroke::new(2.0, Color32::WHITE);
}
frame.paint(ui);

@emilk emilk added the egui label Jan 25, 2024
@emilk emilk merged commit 6b0782c into master Jan 25, 2024
35 checks passed
@emilk emilk deleted the emilk/new-frame-api branch January 25, 2024 18:59
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.

None yet

1 participant