From 982734d240fec273e5d80cf1bc6cd7bb84d749ef Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 01:52:00 +0000 Subject: [PATCH] EditorMock: a screen-mode binding and the Full screen story The old gallery showed the mock app in the Canvas shell in Standard, Full screen, Revealed and Right to left. Full screen is an EditorMock story over the shell's screen_mode binding; right to left is the gallery's own direction switch. --- crates/ui-gallery/src/mock/editor.rs | 17 +++++++++++++---- crates/ui-gallery/src/mock/stories.rs | 12 ++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/crates/ui-gallery/src/mock/editor.rs b/crates/ui-gallery/src/mock/editor.rs index 74b609326..4189f18d8 100644 --- a/crates/ui-gallery/src/mock/editor.rs +++ b/crates/ui-gallery/src/mock/editor.rs @@ -21,7 +21,7 @@ use craft_ui::patterns::form_dialogs::{ use craft_ui::rails::ToolRail; use craft_ui::runtime::commands::{CommandRef, Commands as _, EditCommands}; use craft_ui::runtime::env::{Label, WindowKey}; -use craft_ui::shell::{AppShell, AppShellOutput, CaptionFamily, Captions, Frame, ShellDialogsCx as _, Title, TitleBar}; +use craft_ui::shell::{AppShell, AppShellOutput, CaptionFamily, Captions, Frame, ScreenMode, ShellDialogsCx as _, Title, TitleBar}; use craft_window::Layout; use egui::Ui; @@ -41,24 +41,33 @@ const BLUR_MEMORY: SaveKey = SaveKey::new("craft_ui_gallery.gaussianBlur"); /// - Menus: every row is an app command with its chord; the body takes them. /// - Dialogs: Layer, Delete, Layer and Filter, Gaussian Blur open on the window's dialog host; Image, Image Size /// shows its dialog over the document's size. -/// - Screen modes: the shell's own commands (F) and the reveal keys act inside the window's region. +/// - Screen modes: the shell's own commands (F) and the reveal keys act inside the window's region; the +/// [`screen_mode`](Self::screen_mode) binding holds the mode. #[derive(craft_ui::contract::Pattern)] pub struct EditorMock<'a> { label: Label, state: &'a mut MockState, + screen_mode: Bind<'a, ScreenMode>, } impl<'a> EditorMock<'a> { /// A mock editor named `label` over `state`. pub fn new(label: impl Into