diff --git a/crates/egui_demo_lib/src/demo/modals.rs b/crates/egui_demo_lib/src/demo/modals.rs index e222479390e..75ca2f61161 100644 --- a/crates/egui_demo_lib/src/demo/modals.rs +++ b/crates/egui_demo_lib/src/demo/modals.rs @@ -1,4 +1,4 @@ -use egui::{vec2, Align, ComboBox, Context, Id, Layout, Modal, ProgressBar, Ui, Widget, Window}; +use egui::{Align, ComboBox, Context, Id, Layout, Modal, ProgressBar, Ui, Widget, Window}; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "serde", serde(default))] @@ -36,8 +36,8 @@ impl crate::Demo for Modals { use crate::View as _; Window::new(self.name()) .open(open) - .default_size(vec2(512.0, 512.0)) .vscroll(false) + .resizable(false) .show(ctx, |ui| self.ui(ui)); } } @@ -52,13 +52,22 @@ impl crate::View for Modals { name, } = self; - if ui.button("Open User Modal").clicked() { - *user_modal_open = true; - } + ui.horizontal(|ui| { + if ui.button("Open User Modal").clicked() { + *user_modal_open = true; + } - if ui.button("Open Save Modal").clicked() { - *save_modal_open = true; - } + if ui.button("Open Save Modal").clicked() { + *save_modal_open = true; + } + }); + + ui.label("Click one of the buttons to open a modal."); + ui.label("Modals have a backdrop and prevent interaction with the rest of the UI."); + ui.label( + "You can show modals on top of each other and close the top most modal with \ + escape or by clicking outside the modal.", + ); if *user_modal_open { let modal = Modal::new(Id::new("Modal A")).show(ui.ctx(), |ui| { @@ -134,6 +143,10 @@ impl crate::View for Modals { } }); } + + ui.vertical_centered(|ui| { + ui.add(crate::egui_github_link_file!()); + }); } } diff --git a/crates/egui_demo_lib/tests/snapshots/demos/Modals.png b/crates/egui_demo_lib/tests/snapshots/demos/Modals.png index 52570abf39d..fae10cda862 100644 --- a/crates/egui_demo_lib/tests/snapshots/demos/Modals.png +++ b/crates/egui_demo_lib/tests/snapshots/demos/Modals.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8621e1fe1795ee780e603045574abf208bc94a39eac3bc822988026c7de185d -size 7640 +oid sha256:a2c1613e655d683fda1b6cffc78645c84a3303759aa99951c2b374b387bc9ba5 +size 32892 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_1.png b/crates/egui_demo_lib/tests/snapshots/modals_1.png index 9960411d907..e060f1a27e1 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_1.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:67363dd4c7dbef7d5c1da75067dce5aee399b4db16a9e62216aac1dba6458a3a -size 26197 +oid sha256:612fc82a06832ae31ad5d6fecf3954dca89358aa6ddbe3364687c1c155eb09e4 +size 48220 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_2.png b/crates/egui_demo_lib/tests/snapshots/modals_2.png index 1e450fdcd82..52a24fe4420 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_2.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_2.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7db471ddf1fd7efa4ce4e5cfaf9f84c44c42bd5eb56973f86637410441a87de1 -size 28846 +oid sha256:a9b0e4690fe300c6427d0bf43323023244b71e162097c83e9c2ab7f6e77dc263 +size 48029 diff --git a/crates/egui_demo_lib/tests/snapshots/modals_3.png b/crates/egui_demo_lib/tests/snapshots/modals_3.png index d834f632e26..38c2768e4be 100644 --- a/crates/egui_demo_lib/tests/snapshots/modals_3.png +++ b/crates/egui_demo_lib/tests/snapshots/modals_3.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:411405b136d26c1fa7778b88fd0a359e4f700c0fd7ee7f3c7334576cdc2ac3c8 -size 27010 +oid sha256:78f9c429024268e96a3f0d733172129c0eee29255504204026654c6242796501 +size 43853