From cabd84823e10f6aef031788eeb607ff90e096216 Mon Sep 17 00:00:00 2001 From: viktorstrate Date: Sun, 10 Nov 2024 17:10:56 +0100 Subject: [PATCH] Add ZStack widget and view --- masonry/src/widget/mod.rs | 2 + ...k__tests__zstack_with_button_and_label.png | 3 + ...__tests__zstack_with_button_and_label.snap | 10 + masonry/src/widget/zstack.rs | 135 ++++++++++++ xilem/src/view/mod.rs | 3 + xilem/src/view/zstack.rs | 200 ++++++++++++++++++ 6 files changed, 353 insertions(+) create mode 100644 masonry/src/widget/screenshots/masonry__widget__zstack__tests__zstack_with_button_and_label.png create mode 100644 masonry/src/widget/snapshots/masonry__widget__zstack__tests__zstack_with_button_and_label.snap create mode 100644 masonry/src/widget/zstack.rs create mode 100644 xilem/src/view/zstack.rs diff --git a/masonry/src/widget/mod.rs b/masonry/src/widget/mod.rs index ec41bf3c6..e1e693340 100644 --- a/masonry/src/widget/mod.rs +++ b/masonry/src/widget/mod.rs @@ -31,6 +31,7 @@ mod split; mod textbox; mod variable_label; mod widget_arena; +mod zstack; pub use self::image::Image; pub use align::Align; @@ -52,6 +53,7 @@ pub use variable_label::VariableLabel; pub use widget_mut::WidgetMut; pub use widget_pod::WidgetPod; pub use widget_ref::WidgetRef; +pub use zstack::ZStack; pub(crate) use widget_arena::WidgetArena; pub(crate) use widget_state::WidgetState; diff --git a/masonry/src/widget/screenshots/masonry__widget__zstack__tests__zstack_with_button_and_label.png b/masonry/src/widget/screenshots/masonry__widget__zstack__tests__zstack_with_button_and_label.png new file mode 100644 index 000000000..faaec6255 --- /dev/null +++ b/masonry/src/widget/screenshots/masonry__widget__zstack__tests__zstack_with_button_and_label.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf58dc4e5466d5d47250aca4e4086743bd96b0a09ac43d68340777afb40cb277 +size 6284 diff --git a/masonry/src/widget/snapshots/masonry__widget__zstack__tests__zstack_with_button_and_label.snap b/masonry/src/widget/snapshots/masonry__widget__zstack__tests__zstack_with_button_and_label.snap new file mode 100644 index 000000000..9cde1bf98 --- /dev/null +++ b/masonry/src/widget/snapshots/masonry__widget__zstack__tests__zstack_with_button_and_label.snap @@ -0,0 +1,10 @@ +--- +source: masonry/src/widget/zstack.rs +expression: harness.root_widget() +--- +ZStack( + Button( + Label