mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Fix the constrain option not working in the window options demo (#8433)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> `constrain_to` overrides `constrain`, so I adjusted it to call `constrain_to` before `constrain`. * [x] I have followed the instructions in the PR template Signed-off-by: limo520 <247564335@qq.com>
This commit is contained in:
@@ -71,13 +71,13 @@ impl crate::Demo for WindowOptions {
|
|||||||
let mut window = egui::Window::new(title)
|
let mut window = egui::Window::new(title)
|
||||||
.id(egui::Id::new("demo_window_options")) // required since we change the title
|
.id(egui::Id::new("demo_window_options")) // required since we change the title
|
||||||
.resizable(resizable)
|
.resizable(resizable)
|
||||||
|
.constrain_to(ui.available_rect_before_wrap())
|
||||||
.constrain(constrain)
|
.constrain(constrain)
|
||||||
.collapsible(collapsible)
|
.collapsible(collapsible)
|
||||||
.movable(movable)
|
.movable(movable)
|
||||||
.title_bar(title_bar)
|
.title_bar(title_bar)
|
||||||
.drag_area(drag_area)
|
.drag_area(drag_area)
|
||||||
.scroll(scroll2)
|
.scroll(scroll2)
|
||||||
.constrain_to(ui.available_rect_before_wrap())
|
|
||||||
.enabled(enabled);
|
.enabled(enabled);
|
||||||
if closable {
|
if closable {
|
||||||
window = window.open(open);
|
window = window.open(open);
|
||||||
|
|||||||
Reference in New Issue
Block a user