core: add film-grain overlay for materials
This commit is contained in:
@@ -226,6 +226,8 @@ struct Gallery {
|
||||
alert_open: bool,
|
||||
/// Whether the app sidebar paints the window's native material.
|
||||
sidebar_transparent: bool,
|
||||
/// Whether a film-grain overlay textures the window.
|
||||
grain: bool,
|
||||
}
|
||||
|
||||
impl Gallery {
|
||||
@@ -258,6 +260,7 @@ impl Gallery {
|
||||
let left_sidebar = Sidebar::new("gallery-sidebar")
|
||||
.selected(selected)
|
||||
.transparent(self.sidebar_transparent)
|
||||
.grain(self.grain)
|
||||
.accessibility_label("Component catalog")
|
||||
.entries(|_, _| {
|
||||
CATALOG
|
||||
@@ -300,6 +303,7 @@ impl Gallery {
|
||||
let gallery_change = gallery.clone();
|
||||
Dialog::new("gallery-dialog")
|
||||
.open(open)
|
||||
.grain(true)
|
||||
.title("Delete file?")
|
||||
.on_change(move |open, _, cx| {
|
||||
gallery_change
|
||||
@@ -351,6 +355,7 @@ impl Gallery {
|
||||
Dialog::new("gallery-alert")
|
||||
.open(open)
|
||||
.alert(true)
|
||||
.grain(true)
|
||||
.title("Sign out of the workspace?")
|
||||
.on_change(move |open, _, cx| {
|
||||
gallery_change
|
||||
@@ -595,6 +600,7 @@ impl Render for WelcomePanel {
|
||||
let layout_right = self.layout_state.clone();
|
||||
let dock_state = self.dock_state.clone();
|
||||
let gallery = self.gallery.clone();
|
||||
let grain_gallery = self.gallery.clone();
|
||||
|
||||
ScrollArea::new("welcome-demo")
|
||||
.size_full()
|
||||
@@ -667,6 +673,20 @@ impl Render for WelcomePanel {
|
||||
.log_err();
|
||||
}),
|
||||
)
|
||||
.child(
|
||||
Button::new("welcome-toggle-grain")
|
||||
.label("Toggle grain")
|
||||
.variant(ButtonVariant::Secondary)
|
||||
.small()
|
||||
.on_click(move |_, _, cx| {
|
||||
grain_gallery
|
||||
.update(cx, |gallery, cx| {
|
||||
gallery.grain = !gallery.grain;
|
||||
cx.notify();
|
||||
})
|
||||
.log_err();
|
||||
}),
|
||||
)
|
||||
.child(
|
||||
Button::new("welcome-split")
|
||||
.label("Split active right")
|
||||
@@ -4470,6 +4490,7 @@ fn main() {
|
||||
dialog_open: false,
|
||||
alert_open: false,
|
||||
sidebar_transparent: true,
|
||||
grain: true,
|
||||
});
|
||||
|
||||
let palette = cx.new(|cx| {
|
||||
|
||||
Reference in New Issue
Block a user